/* ============================================================
 * Vetrina Base CSS — Stili universali senza brand color
 * ============================================================
 * Questo file contiene i layout e gli stili strutturali base
 * per la vetrina multi-tenant. I colori brand sono definiti
 * in sottocartelle tema (iccrea/, cassacentrale/, marcasolidale/)
 * tramite override CSS variables nel :root
 */

:root {
    --vetrina-primary: #1d388e;
    --vetrina-primary-light: #DDE8F7;
    --vetrina-secondary: #DBF1D8;
    --vetrina-title: #4B9F52;
    --vetrina-background: transparent;
}

* {
    font-family: "Cabin", sans-serif;
}

/* ============================================================
 * UTILITIES
 * ============================================================ */

.title-section {
    font-weight: 400;
    line-height: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle-section {
    font-weight: 600;
    line-height: 2.25rem;
    margin-bottom: 1.5rem;
}

/* ============================================================
 * SERVIZIO HEADER
 * ============================================================ */

.servizio-header.image {
    height: 350px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position-x: center;
    position: relative;
}

.servizio-header .color-gradient {
    width: 100%;
    height: 100%;
    position: absolute;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--bs-primary) 150%);
}

.servizio-header .container-title {
    position: absolute;
    bottom: 1rem;
    left: 4rem;
}

/* ============================================================
 * CARD COMUNICAZIONI
 * ============================================================ */

.card-comunicazioni {
    background-color: #f8f9fa;
    border-radius: 0;
    overflow: hidden;
}

.card-comunicazioni-body {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
}

.card-comunicazioni-image-link {
    flex: 0 0 250px;
}

.card-comunicazioni-body .image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
}

.card-comunicazioni-content {
    padding: 1rem 1.5rem 1rem 0;
    flex-grow: 1;
}

.card-comunicazioni-content .title {
    color: #212529;
    font-size: 1.2rem;
}

.card-comunicazioni-content .description {
    color: #6c757d;
    font-size: 0.95rem;
}

.card-comunicazioni-content .action {
    text-align: right;
}

.card-comunicazioni-content .action a {
    color: #00796B;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.card-comunicazioni-content .action a:hover {
    color: #004D40;
    text-decoration: underline;
}

/* ============================================================
 * NEWS CARD IMAGE CONTAINER
 * ============================================================ */

.news-card-image-container {
    height: 200px;
    overflow: hidden;
    background-color: #f0f0f0;
    border-top-left-radius: var(--bs-card-border-radius);
    border-top-right-radius: var(--bs-card-border-radius);
}

.news-card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ============================================================
 * CHIPS/BADGES
 * ============================================================ */

.chips {
    display: inline-flex;
    align-items: center;
    border-radius: 50rem !important;
    font-weight: 600;
    font-size: 13px;
    padding-left: 10px;
    padding-right: 10px;
    text-transform: uppercase;
    margin-right: 1rem;
}

.chips-outline-light {
    background-color: transparent;
    border: 1px solid white;
    color: var(--bs-light);
}

.chips-outline-secondary {
    background-color: transparent;
    border: 1px solid var(--bs-secondary);
    color: var(--bs-secondary);
}

.chips-outline-primary {
    background-color: transparent;
    border: 1px solid var(--bs-primary);
    color: var(--bs-primary);
}

.chips-outline-dark {
    background-color: transparent;
    border: 1px solid var(--bs-dark);
    color: var(--bs-dark);
}

.chips-outline-success {
    background-color: transparent;
    border: 1px solid var(--bs-success);
    color: var(--bs-dark);
}

.chips-primary {
    background-color: var(--bs-primary);
    color: white;
}

.chips-secondary {
    background-color: var(--bs-secondary);
    color: white;
}

.chips-danger {
    background-color: var(--bs-danger);
    color: white;
}

.chips-light {
    background-color: white;
    color: black;
}

.chips-dark {
    background-color: var(--bs-dark);
    color: white;
}

.chips-success {
    background-color: var(--bs-success);
    color: white;
}

.chips-warning {
    background-color: var(--bs-warning);
    color: white;
}

/* ============================================================
 * TEXT UTILITIES
 * ============================================================ */

.text-primary {
    color: var(--theme-primary) !important;
}

.text-gradient {
    background: linear-gradient(90deg, var(--theme-primary) 44.51%, var(--theme-title) 66.39%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bg-primary {
    background-color: var(--theme-primary) !important;
}

.bg-primary-light {
    background-color: var(--theme-primary-light) !important;
}

.bg-secondary {
    background-color: var(--theme-secondary) !important;
}

.icon-news {
    width: 25px;
}

/* ============================================================
 * NAVBAR
 * ============================================================ */

.navbar .nav-link {
    color: var(--theme-primary);
    font-family: "Cabin", sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 400;
    line-height: 28px;
}

.nav-link {
    padding: 0 1rem;
    margin: 0.5rem 0;
}

.navbar .nav-button {
    background: var(--theme-primary);
    color: white;
    border-radius: 100px;
    padding: 0.5rem;
}

.navbar img {
    width: 80px;
}

/* ============================================================
 * HEADER
 * ============================================================ */

.vetrina-header {
    border-radius: 0 0 5px 5px;
    overflow: hidden;
    z-index: 1;
    height: 500px;
}

.vetrina-header::before {
    content: '';
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    background: linear-gradient(to bottom, transparent, var(--theme-background));
    opacity: 0.4;
    height: 100%;
    z-index: 2;
}

.vetrina-header .container {
    z-index: 3;
}

/* ============================================================
 * NEWS
 * ============================================================ */

#news .icon-news:hover {
    opacity: 0.5;
    border-radius: 50%;
}

#news-slider .card {
    border: none;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.news-slider .card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

/* ============================================================
 * SCROLL TO TOP BUTTON
 * ============================================================ */

#btnTop {
    color: var(--theme-primary);
    cursor: pointer;
    font-size: 1.5rem;
    position: fixed;
    bottom: 10px;
    right: 20px;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#btnTop.show {
    opacity: 0.7;
    visibility: visible;
}

#btnTop:hover {
    opacity: 1;
}

/* ============================================================
 * SWIPER NEWS CAROUSEL — slide stretch a stessa altezza
 * ============================================================ */

.vetrina-news-swiper .swiper-wrapper {
    align-items: stretch;
}

.vetrina-news-swiper .swiper-slide {
    height: auto;
    display: flex;
}

.vetrina-news-swiper .swiper-slide > .card {
    width: 100%;
}

/* ============================================================
 * ANIMATION PREPARATION CLASSES (Porting Public P1 pattern)
 * ============================================================ */

.prepare-animation-dx {
    animation: slideInRight 1.5s ease forwards;
}

.prepare-animation-sx {
    animation: slideInLeft 1.5s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================================
 * FADE/ZOOM ANIMATIONS
 * ============================================================ */

/*
 * Animazioni scroll-triggered (allinea behavior AOS originale del progetto WO).
 *
 * Stato di default delle classi `.vetrina-animate-*` = opacity 0 + transform iniziale.
 * L'animazione parte SOLO quando l'elemento ottiene la classe `.in-view`, aggiunta
 * dal plugin `@alpinejs/intersect` tramite `x-intersect.once="$el.classList.add('in-view')"`
 * sull'elemento o un wrapper genitore. Durata 1.5s, easing `ease` (default AOS).
 */
.vetrina-animate-fade-up,
.vetrina-animate-fade-right,
.vetrina-animate-fade-left,
.vetrina-animate-zoom-in {
    opacity: 0;
    animation-duration: 1.5s;
    animation-timing-function: ease;
    animation-fill-mode: forwards;
    animation-play-state: paused;
}

.vetrina-animate-fade-up { animation-name: fadeUp; transform: translateY(30px); }
.vetrina-animate-fade-right { animation-name: fadeRight; transform: translateX(-30px); }
.vetrina-animate-fade-left { animation-name: fadeLeft; transform: translateX(30px); }
.vetrina-animate-zoom-in { animation-name: zoomIn; transform: scale(0.9); }

.vetrina-animate-fade-up.in-view,
.vetrina-animate-fade-right.in-view,
.vetrina-animate-fade-left.in-view,
.vetrina-animate-zoom-in.in-view {
    animation-play-state: running;
}

/* Ritardo scaglionato per elementi adiacenti (es. card "Azienda/Dipendente/Esercente") */
.vetrina-animate-delay-1 { animation-delay: 0.15s; }
.vetrina-animate-delay-2 { animation-delay: 0.30s; }
.vetrina-animate-delay-3 { animation-delay: 0.45s; }

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeLeft {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */

@media (max-width: 768px) {
    .card-comunicazioni-body {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .card-comunicazioni-image-link {
        flex-basis: auto;
    }

    .card-comunicazioni-body .image {
        height: 220px;
    }

    .card-comunicazioni-content {
        padding: 1.5rem;
    }
}

@media (min-width: 780px) {
    .icon-news {
        width: 32px;
    }

    .navbar img {
        width: 150px;
    }

    .navbar .nav-link {
        font-size: 16px;
    }

    .header {
        height: 600px;
    }
}

@media (min-width: 1024px) {
    .icon-news {
        width: 42px;
    }

    .navbar .nav-link {
        font-size: 20px;
    }

    .header {
        height: 690px;
    }

    #btnTop {
        bottom: 5px;
        font-size: 2rem;
    }
}
