﻿/**
 * Componente Cards
 * Layout griglia o scroll orizzontale per le cards
 */

.cards-block {
    padding: 4rem 0;
    background-color: #f8f9fa;
    width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.cards-section-header {
    max-width: 1200px;
    margin: 0 auto 2.5rem;
    padding: 0 2rem;
    box-sizing: border-box;
    text-align: center;
}

.cards-section-title {
    font-family: var(--font-title);
    font-size: 2.25rem;
    font-weight: normal;
    line-height: 1.25;
    color: #000000;
    margin: 0;
}

.cards-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Layout Griglia */
.cards-grid {
    display: grid;
    gap: 2rem;
}

.cards-grid .card-item.aq-card-hidden {
    display: none !important;
}

.cards-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding: 0 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.cards-load-more-btn.card-button {
    background-color: #000000 !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cards-load-more-btn.card-button:hover {
    background-color: #fff !important;
    color: #000 !important;
    box-shadow: inset 0 0 0 2px #000;
    opacity: 1;
}

.cards-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.cards-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.cards-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Layout Scroll Orizzontale - Swiper */
.cards-swiper {
    width: 100% !important;
    max-width: 100%;
    padding-bottom: 2.5rem;
    overflow: hidden;
    box-sizing: border-box;
    margin: 0;
}

/* Desktop: Swiper a 1264px */
@media (min-width: 769px) {
    .cards-swiper {
        width: 1264px !important;
        max-width: 1264px;
        margin: 0 auto;
    }
}

.cards-swiper .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

/* Mantieni compatibilità con vecchie classi */
.cards-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2.5rem;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.cards-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* Swiper gestisce automaticamente le larghezze delle slide */

/* Vecchio sistema (mantenuto per compatibilità) */
.cards-scroll-columns-2 .card-item {
    flex: 0 0 calc(50% - 0.75rem);
    min-width: calc(50% - 0.75rem);
    width: calc(50% - 0.75rem);
}

.cards-scroll-columns-3 .card-item {
    flex: 0 0 calc(33.333% - 1rem);
    min-width: calc(33.333% - 1rem);
    width: calc(33.333% - 1rem);
}

.cards-scroll-columns-4 .card-item {
    flex: 0 0 calc(25% - 1.125rem);
    min-width: calc(25% - 1.125rem);
    width: calc(25% - 1.125rem);
}

/* Paginazione stile Material Design */
.cards-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0 2rem;
}

.cards-pagination-bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.3); /* Marrone chiaro */
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    outline: none;
}

.cards-pagination-bullet.active {
    width: 24px;
    height: 8px;
    border-radius: 4px;
    background-color: #000000; /* Marrone principale */
}

.cards-pagination-bullet:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

.cards-pagination-bullet.active:hover {
    background-color: #000000;
}

/* Card Item - Immagine come background, minimo quadrata */
.card-item {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll; /* Evita problemi di parallax e ricalcoli */
    border-radius: 0;
    overflow: hidden; /* Cambiato da visible a hidden per evitare overflow */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 0;
}

/* Card minimo quadrata - si allunga se necessario */
.cards-grid .card-item {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Tutte le card della stessa sezione hanno la stessa altezza */
.cards-grid {
    align-items: stretch;
}

.cards-grid .card-item {
    height: auto;
}

/* Contenuto che può espandersi */
.cards-grid .card-content {
    position: relative;
    width: 100%;
}

/* Card a scorrimento - minimo quadrate e si allungano */
.cards-scroll {
    align-items: stretch;
}

/* Card a scorrimento - Swiper */
.cards-swiper .swiper-slide {
    height: auto;
    display: flex;
}

.cards-swiper .card-item {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
    height: 100%;
    user-select: none; /* Testo non selezionabile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Card a scorrimento - vecchio sistema (mantenuto per compatibilità) */
.cards-scroll .card-item {
    position: relative;
    scroll-snap-align: start;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Permetti selezione solo per i link */
.cards-scroll .card-item .card-button,
.cards-swiper .card-item .card-button {
    user-select: auto;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
}

/* Contenuto che può espandersi */
.cards-scroll .card-content {
    position: relative;
    width: 100%;
}

/* Overlay nero automatico 40% sotto titolo/testo */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
    pointer-events: none;
}

/* Layout unificato per tutte le card: titolo in alto, testo sotto, pulsanti in fondo */
.card-content {
    position: relative;
    width: 100%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    justify-content: flex-start;
    box-sizing: border-box;
    overflow: visible;
}

.card-content .card-title {
    margin-top: 2rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.card-content .card-text {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.card-content .card-short-description,
.card-content .card-full-text {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.card-content .card-buttons {
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 0;
}

.card-title {
    font-family: var(--font-title) !important;
    font-size: 2rem;
    font-weight: normal !important;
    font-style: normal !important;
    line-height: 1.2;
    color: #fff !important;
    margin: 0 0 1rem 0;
}

/* Corpo testo: Patrick Hand SC; titoli: DM Serif Display */
.card-text {
    font-family: var(--font-hand) !important;
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.4;
    font-weight: 400;
    font-style: normal;
}

.card-short-description {
    font-family: var(--font-hand) !important;
    font-size: 1.5rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    color: #fff;
    font-weight: 400;
    font-style: normal;
}

.card-full-text {
    font-family: var(--font-body) !important;
    font-size: 1.5rem;
    line-height: 1.2;
    color: #fff;
    font-weight: 400;
    font-style: normal;
}

.card-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Desktop: corpo testo solo nella metà sinistra della card (titolo a tutta larghezza) */
@media (min-width: 769px) {
    .card-content .card-text {
        max-width: 50%;
        width: 100%;
        align-self: flex-start;
        box-sizing: border-box;
    }
}

.card-button {
    background-color: #fff;
    color: #000000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: none;
    cursor: pointer;
}

/* Tablet */
@media (max-width: 768px) {
    .cards-block {
        padding: 3rem 0;
    }

    .cards-section-header {
        padding: 0 1.5rem;
        margin-bottom: 2rem;
    }

    .cards-section-title {
        font-size: 1.85rem;
    }
    
    .cards-container {
        padding: 0 1.5rem;
    }
    
    .cards-columns-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .cards-columns-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    .cards-columns-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .card-item {
        padding: 1.5rem;
    }
    
    .card-title {
        font-size: 2rem;
    }
    
}

/* Mobile */
@media (max-width: 480px) {
    .cards-block {
        padding: 2rem 0;
    }

    .cards-section-header {
        padding: 0 1rem;
        margin-bottom: 1.5rem;
    }

    .cards-section-title {
        font-size: 1.65rem;
    }
    
    .cards-container {
        padding: 0 1rem;
        overflow-x: hidden;
    }
    
    /* Su mobile, griglia diventa 1 colonna */
    .cards-columns-2,
    .cards-columns-3,
    .cards-columns-4 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Scroll orizzontale su mobile - Swiper */
    .cards-swiper {
        padding-bottom: 1rem;
    }
    
    .cards-swiper .card-item {
        min-height: 0;
        background-size: cover;
        background-attachment: scroll;
        background-position: center center;
    }
    
    /* Vecchio sistema (mantenuto per compatibilità) */
    .cards-scroll {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        gap: 1rem;
        padding-bottom: 1rem;
        align-items: flex-start;
    }
    
    .cards-scroll .card-item {
        flex: 0 0 100%;
        min-width: 100%;
        width: 100%;
        scroll-snap-align: start;
        min-height: 0 !important;
        height: auto;
        background-size: cover;
        background-attachment: scroll;
        background-position: center center;
        overflow: hidden;
    }
    
    .cards-scroll-columns-2 .card-item,
    .cards-scroll-columns-3 .card-item,
    .cards-scroll-columns-4 .card-item {
        flex: 0 0 100%;
        min-width: 100%;
        width: 100%;
    }
    
    /* Su mobile le card non hanno altezza uniforme */
    .cards-grid {
        align-items: flex-start;
    }
    
    .cards-grid .card-item {
        height: auto;
    }
    
    /* Card scroll su mobile: padding ridotto */
    .cards-scroll .card-item {
        padding: 1rem 1.25rem; /* Ridotto padding top */
        min-height: 0 !important;
    }
    
    /* Card grid su mobile: min-height normale */
    .cards-grid .card-item {
        padding: 1.25rem;
        min-height: 200px;
    }
    
    /* Riduci padding del contenuto su mobile */
    .cards-scroll .card-content {
        padding: 1.5rem 1.25rem; /* Ridotto da 2rem */
    }
    
    .cards-scroll .card-content .card-title {
        margin-top: 1rem; /* Ridotto da 2rem */
    }
    
    .card-title {
        font-size: 2rem;
    }
    
    .card-button {
        width: auto;
    }

    .card-content {
        padding: 0;
    }
}

