/*
 * Homepage retail: mosaico dei banner e sezione "Why choose Extralite?" (blocchi page-home-block-*).
 * Caricato solo dalla home, dopo typography.css.
 */

/* ---------- Mosaico dei banner (home.twig) ----------
   4 colonne da 992px, 2 sotto. L'altezza di una cella (--cell) segue la larghezza delle colonne (container query),
   così le proporzioni dei riquadri restano le stesse a ogni larghezza. Le righe sono libere: i riquadri Full
   prendono l'altezza della loro foto, senza tagli. */
.home-mosaic-section {
    margin-top: 0;
    padding-top: 0;
}
/* contenitore della query: 100cqw è la larghezza utile del .container, padding escluso */
.home-mosaic-section > .container {
    container-type: inline-size;
}
.home-mosaic {
    --cols: 2;
    --gap: 8px;
    display: grid;
    --cell: calc((100cqw - (var(--cols) - 1) * var(--gap)) / var(--cols) * .72);
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: var(--gap);
}
@media (min-width: 992px) {
    .home-mosaic {
        --cols: 4;
        --gap: 12px;
    }
}

.home-tile {
    position: relative;
    min-width: 0;
    height: var(--cell);
    overflow: hidden;
    background: #111;
    border-radius: 6px;
}
.home-tile--medium {
    grid-column: span 2;
    grid-row: span 2;
    height: calc(2 * var(--cell) + var(--gap));
}
.home-tile--tall {
    grid-row: span 2;
    height: calc(2 * var(--cell) + var(--gap));
}
.home-tile--full {
    grid-column: 1 / -1;
    height: auto;
}
.home-tile__link {
    display: block;
    height: 100%;
}
/* Full: alta quanto serve per mostrare la foto intera (--ratio = larghezza / altezza, da image_ratio) */
.home-tile--full .home-tile__link {
    aspect-ratio: var(--ratio, 3);
}
.home-tile img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s ease;
}

/* riquadri con testo: sfumatura in basso per la leggibilità e etichetta in basso a sinistra */
.home-tile__link:has(.home-tile__label)::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 55%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    pointer-events: none;
}
.home-tile__label {
    position: absolute;
    left: 20px;
    bottom: 18px;
    z-index: 1;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

.home-tile__link:focus-visible {
    outline: 2px solid #0deaf1;
    outline-offset: -2px;
}
@media (hover: hover) {
    .home-tile__link:hover img {
        transform: scale(1.04);
    }
}
@media (max-width: 575px) {
    .home-tile__label {
        left: 12px;
        bottom: 10px;
        font-size: 16px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .home-tile img {
        transition: none;
    }
}

.home-why {
    --home-accent: red;
    /* stesso blu dei tab della scheda prodotto (prodotti/dettaglio.twig) */
    --home-tab-blue: blue;
    padding-top: 40px;
    padding-bottom: 100px;
}

.home-why__header {
    max-width: 760px;
    margin: 0 auto 48px;
    text-align: center;
}

.home-why__title {
    color: var(--home-accent);
    margin-bottom: 16px;
}

.home-why__lead {
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.85);
}

.home-why__card {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 32px 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 3px solid var(--home-tab-blue);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    align-items: center;
    text-align: center;
}

.home-why__icon {
    display: block;
    margin: 0 auto 20px;
    font-size: 36px;
    line-height: 1;
    color: #fff;
}

.home-why__card-title {
    margin: 0 0 14px;
    font-size: 19px;
    line-height: 1.3;
    color: #fff;
    text-transform: none;
}

.home-why__text {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.72);
}

.home-why__text:last-child {
    margin-bottom: 0;
}

@media (max-width: 767px) {
    .home-why {
        padding-bottom: 60px;
    }

    .home-why__header {
        margin-bottom: 32px;
    }

    .home-why__card {
        padding: 24px 20px;
    }
}

/* ---------- Instagram (homepage/_instagram.twig), prima del footer ---------- */
.home-instagram {
    padding-top: 0;
    padding-bottom: 100px;
}
.home-instagram__header {
    margin: 0 auto 32px;
    text-align: center;
}
.home-instagram__title {
    margin-bottom: 6px;
    color: red; /* come il titolo di "Why choose Extralite" */
}
.home-instagram__handle {
    color: #0deaf1;
    font-size: 16px;
    font-weight: 600;
}
.home-instagram__handle:hover,
.home-instagram__handle:focus-visible {
    color: #fff;
    text-decoration: underline;
}
/* desktop: 4 colonne, foto quadrate */
.home-instagram__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.home-instagram__link {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    background: #111;
    border-radius: 8px;
}
.home-instagram__link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
/* al passaggio: foto un po' più grande e il logo Instagram sopra un velo scuro */
.home-instagram__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 34px;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity .2s ease;
}
.home-instagram__link:hover img,
.home-instagram__link:focus-visible img {
    transform: scale(1.05);
}
.home-instagram__link:hover .home-instagram__overlay,
.home-instagram__link:focus-visible .home-instagram__overlay {
    opacity: 1;
}
.home-instagram__link:focus-visible {
    outline: 2px solid #0deaf1;
    outline-offset: 2px;
}
/* video: piccolo "play" nell'angolo */
.home-instagram__badge {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 14px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.home-instagram__cta {
    margin-top: 32px;
    text-align: center;
}
.home-instagram__cta .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* mobile: una riga che scorre di lato, la foto successiva si intravede a bordo schermo */
@media (max-width: 767px) {
    .home-instagram {
        padding-bottom: 60px;
    }
    .home-instagram__header {
        margin-bottom: 20px;
    }
    .home-instagram__grid {
        display: flex;
        gap: 10px;
        margin: 0 -15px; /* fino ai bordi dello schermo, oltre il padding del container */
        padding: 0 15px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 15px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .home-instagram__grid::-webkit-scrollbar {
        display: none;
    }
    .home-instagram__item {
        flex: 0 0 64%;
        scroll-snap-align: start;
    }
    .home-instagram__cta {
        margin-top: 20px;
    }
    .home-instagram__cta .btn {
        width: 100%;
        justify-content: center;
        height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-instagram__link img,
    .home-instagram__overlay {
        transition: none;
    }
}
