/**
 * Home motion — «I documenti sul banco»
 * Ingresso: foto evidenza + prima riga di primo piano.
 * La card testo di #primo-piano-in-evidenza resta ferma.
 * Hover sulle card (puntatore fine). Tastiera: solo la freccia, niente lift.
 * Calendario: foglio del giorno (oggi, o primo giorno visibile).
 */

body.home #main-container {
    --siagid-home-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --siagid-home-feedback: 180ms;
    --siagid-home-shadow: 0 0.125rem 0.25rem rgba(17, 24, 39, 0.08);
    --siagid-home-shadow-lift: 0 0.5rem 1.25rem rgba(17, 24, 39, 0.12);
}

@keyframes siagid-home-sheet {
    from {
        translate: 0 -12px;
    }

    to {
        translate: 0 0;
    }
}

@keyframes siagid-home-photo {
    from {
        clip-path: inset(0 0 16% 0);
        translate: 0 -14px;
        filter: blur(2px);
    }

    to {
        clip-path: inset(0);
        translate: 0 0;
        filter: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    body.home #primo-piano-in-evidenza .order-lg-2 {
        overflow: hidden;
    }

    body.home #primo-piano-in-evidenza .order-lg-2 img {
        display: block;
        max-width: 100%;
        animation: siagid-home-photo 520ms var(--siagid-home-ease) 60ms backwards;
    }

    body.home #primo-piano .row > [class*="col-"]:nth-child(-n + 3) .it-card {
        animation: siagid-home-sheet 460ms var(--siagid-home-ease) backwards;
    }

    body.home #primo-piano .row > [class*="col-"]:nth-child(1) .it-card {
        animation-delay: 80ms;
    }

    body.home #primo-piano .row > [class*="col-"]:nth-child(2) .it-card {
        animation-delay: 140ms;
    }

    body.home #primo-piano .row > [class*="col-"]:nth-child(3) .it-card {
        animation-delay: 200ms;
    }
}

body.home #main-container .it-card,
body.home #main-container .card.card-teaser {
    transition:
        translate var(--siagid-home-feedback) var(--siagid-home-ease),
        box-shadow var(--siagid-home-feedback) var(--siagid-home-ease);
}

body.home #main-container .it-card-image-wrapper,
body.home #main-container .it-card-image-wrapper .ratio,
body.home #main-container .it-card-image-wrapper .figure {
    overflow: hidden;
}

body.home #main-container .it-card-image-wrapper img,
body.home #main-container .it-card-image-wrapper .figure img {
    transform-origin: center center;
    transition: scale 320ms var(--siagid-home-ease);
}

body.home #main-container .it-card-link svg.icon,
body.home #main-container .read-more svg.icon,
body.home #main-container .it-card-title-icon-wrapper svg.icon {
    transition: translate var(--siagid-home-feedback) var(--siagid-home-ease);
}

body.home #main-container .it-card:has(a:focus-visible) .it-card-link svg.icon,
body.home #main-container .it-card:has(a:focus-visible) .read-more svg.icon,
body.home #main-container .it-card:has(a:focus-visible) .it-card-title-icon-wrapper svg.icon,
body.home #main-container .card.card-teaser:has(a:focus-visible) .read-more svg.icon {
    translate: 4px 0;
}

@media (hover: hover) and (pointer: fine) {
    body.home #main-container .it-card:hover,
    body.home #main-container .card.card-teaser:hover {
        position: relative;
        z-index: 2;
        translate: 0 -4px;
        box-shadow: var(--siagid-home-shadow-lift);
    }

    body.home #main-container .it-card:hover .it-card-image-wrapper img,
    body.home #main-container .it-card:hover .it-card-image-wrapper .figure img {
        scale: 1.045;
    }

    body.home #main-container .it-card:hover .it-card-link svg.icon,
    body.home #main-container .it-card:hover .read-more svg.icon,
    body.home #main-container .it-card:hover .it-card-title-icon-wrapper svg.icon,
    body.home #main-container .card.card-teaser:hover .read-more svg.icon {
        translate: 4px 0;
    }
}

/* Card nidificate (argomenti → sito tematico): alza solo il contenitore. */
body.home #main-container .it-card .it-card:hover,
body.home #main-container .it-card .card:hover {
    translate: 0;
    box-shadow: var(--siagid-home-shadow);
}

/* Card testo evidenza: nessuna animazione (ingresso, hover, focus). */
body.home #main-container #primo-piano-in-evidenza .it-card,
body.home #main-container #primo-piano-in-evidenza .it-card:hover,
body.home #main-container #primo-piano-in-evidenza .it-card:focus-within {
    animation: none;
    transition: none;
    translate: none;
    box-shadow: none;
}

@keyframes siagid-home-day-sheet {
    from {
        clip-path: inset(18% 0 0 0);
        translate: 0 -10px;
    }

    to {
        clip-path: inset(0);
        translate: 0 0;
    }
}

@keyframes siagid-home-day-rule {
    from {
        scale: 0 1;
    }

    to {
        scale: 1 1;
    }
}

body.home #calendario .card.card-bg {
    transition:
        translate var(--siagid-home-feedback) var(--siagid-home-ease),
        box-shadow var(--siagid-home-feedback) var(--siagid-home-ease);
}

body.home #calendario .is-calendar-sheet {
    background-color: color-mix(in srgb, var(--bs-primary) 6%, #fff);
}

body.home #calendario .is-calendar-sheet .card-title {
    position: relative;
}

body.home #calendario .is-calendar-sheet .card-title::after {
    content: "";
    display: block;
    width: 2.5rem;
    height: 2px;
    margin-top: 0.35rem;
    background-color: var(--bs-primary);
    transform-origin: left center;
}

body.home #calendario .card-text {
    transition: translate var(--siagid-home-feedback) var(--siagid-home-ease);
}

body.home #calendario .card-text a:not(.text-danger) {
    color: var(--bs-primary);
}

body.home #calendario .splide__arrow {
    color: var(--bs-primary);
    transition: color 150ms var(--siagid-home-ease);
}

body.home #calendario .splide__arrow:not(:disabled):hover,
body.home #calendario .splide__arrow:not(:disabled):focus-visible {
    color: color-mix(in srgb, var(--bs-primary) 72%, #000);
}

@media (prefers-reduced-motion: no-preference) {
    body.home #calendario .is-calendar-sheet .card-title {
        animation: siagid-home-day-sheet 480ms var(--siagid-home-ease) backwards;
    }

    body.home #calendario .is-calendar-sheet .card-title::after {
        animation: siagid-home-day-rule 420ms var(--siagid-home-ease) 80ms backwards;
    }
}

@media (hover: hover) and (pointer: fine) {
    body.home #calendario .card.card-bg:hover {
        position: relative;
        z-index: 2;
        translate: 0 -4px;
        box-shadow: var(--siagid-home-shadow-lift);
    }

    body.home #calendario .card-text:hover {
        translate: 4px 0;
    }
}

body.home #calendario .card-text:has(a:focus-visible) {
    translate: 4px 0;
}

@media (prefers-reduced-motion: reduce) {
    body.home #main-container .it-card,
    body.home #main-container .card.card-teaser,
    body.home #primo-piano-in-evidenza .order-lg-2 img,
    body.home #main-container .it-card-image-wrapper img,
    body.home #main-container .it-card-link svg.icon,
    body.home #main-container .read-more svg.icon,
    body.home #main-container .it-card-title-icon-wrapper svg.icon,
    body.home #calendario .card.card-bg,
    body.home #calendario .is-calendar-sheet .card-title,
    body.home #calendario .is-calendar-sheet .card-title::after,
    body.home #calendario .card-text,
    body.home #calendario .splide__arrow {
        animation: none !important;
        transition: none !important;
        translate: none !important;
        scale: none !important;
        filter: none !important;
        clip-path: none !important;
    }
}

@media print {
    body.home #main-container .it-card,
    body.home #main-container .card.card-teaser,
    body.home #primo-piano-in-evidenza .order-lg-2 img,
    body.home #calendario .card.card-bg,
    body.home #calendario .is-calendar-sheet .card-title {
        animation: none !important;
        transition: none !important;
        translate: none !important;
        filter: none !important;
        clip-path: none !important;
        box-shadow: none !important;
    }
}
