/*
 * Regole responsive caricate dopo i fogli principali.
 * Il layout desktop originale resta attivo oltre i 1200px.
 */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 110px;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

.header_contacts {
    background-color: var(--red);
    color: white;
    padding: 10px 0;
    font-size: 15px;
    letter-spacing: .8px;
}

.header_contacts_inner,
.header_contact_links,
.header_main {
    display: flex;
}

.header_contacts_inner,
.header_main {
    justify-content: space-between;
    gap: 40px;
}

.header_contact_links {
    gap: 20px;
}

.header_main {
    position: relative;
    padding: 20px 0;
    z-index: 30;
}

#main_nav {
    display: flex;
    align-items: center;
}

#handle_menu {
    display: none;
}

@media screen and (max-width: 1200px) {
    html {
        scroll-padding-top: 90px;
    }

    body {
        font-size: 17px;
    }

    body.menu_open {
        overflow: hidden;
    }

    .w_def {
        width: 90%;
    }

    h1 {
        font-size: clamp(40px, 6vw, 54px);
        line-height: 1.08;
    }

    h2 {
        font-size: clamp(34px, 4.5vw, 42px);
        line-height: 1.12;
    }

    .space {
        height: 75px;
    }

    .space_mid {
        height: 40px;
    }

    .cols2 {
        gap: 35px;
    }

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

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

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

    header .logo {
        top: 10px;
    }

    #handle_menu {
        width: 48px;
        height: 48px;
        padding: 10px 8px;
        border: 0;
        background: transparent;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 7px;
        cursor: pointer;
        position: relative;
        z-index: 102;
    }

    #handle_menu span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: #171717;
        transition: transform 250ms ease, opacity 200ms ease;
        transform-origin: center;
    }

    .menu_open #handle_menu span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .menu_open #handle_menu span:nth-child(2) {
        opacity: 0;
    }

    .menu_open #handle_menu span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    #main_nav {
        display: block;
        position: fixed;
        inset: 0 0 0 auto;
        width: min(480px, 100vw);
        box-sizing: border-box;
        padding: 175px 5vw 50px;
        background-color: white;
        overflow-y: auto;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 350ms ease, visibility 350ms;
        box-shadow: -20px 0 45px rgba(0, 0, 0, .16);
        z-index: 100;
    }

    .menu_open #main_nav {
        transform: translateX(0);
        visibility: visible;
    }

    #main_nav::before {
        content: "";
        position: fixed;
        inset: 0 100% 0 auto;
        width: calc(100vw - min(480px, 100vw));
        background: rgba(0, 0, 0, .55);
    }

    header ul,
    header .submenu {
        flex-direction: column;
        width: 100%;
    }

    header ul {
        gap: 0;
    }

    header ul > li {
        border-bottom: 1px solid rgba(23, 23, 23, .15);
    }

    header ul > li > a {
        display: block;
        padding: 18px 0;
        font-size: 21px;
    }

    header .submenu {
        position: static;
        box-sizing: border-box;
        max-height: 0;
        overflow: hidden;
        padding: 0 0 0 18px;
        gap: 0;
        transform: none;
        visibility: hidden;
        transition: max-height 350ms ease, visibility 350ms;
    }

    header ul li:hover .submenu {
        transform: none;
    }

    header li.submenu_open .submenu {
        max-height: 650px;
        visibility: visible;
    }

    header .submenu::before {
        display: none;
    }

    header .submenu li:last-child {
        border-bottom: 0;
    }

    header .submenu li a {
        padding: 13px 0;
        font-size: 17px;
    }

    .submenu_label svg {
        transition: transform 250ms ease;
    }

    .submenu_open .submenu_label svg {
        transform: rotate(90deg);
    }

    .sub_header {
        min-height: 540px;
        height: calc(100svh - 98px);
    }

    .sub_header.reduced {
        min-height: 380px;
        max-height: 55svh;
    }

    .sub_header .info .typed_properties * {
        font-size: 27px;
    }

    .grid.partners img {
        width: min(220px, 90%);
    }

    .points {
        --point-width: min(480px, 72%);
    }
}

@media screen and (max-width: 700px) {
    html {
        scroll-padding-top: 75px;
    }

    body {
        font-size: 16px;
    }

    p {
        line-height: 25px;
    }

    .w_def {
        width: 90%;
    }

    h1 {
        font-size: clamp(34px, 11vw, 46px);
    }

    h2,
    .points_bck h2[style] {
        font-size: clamp(29px, 9vw, 38px) !important;
    }

    h3 {
        font-size: 23px;
    }

    .space {
        height: 55px;
    }

    .space_mid {
        height: 32px;
    }

    .space_small {
        height: 20px;
    }

    .btn {
        box-sizing: border-box;
        padding: 16px 14px;
        box-shadow: 10px 10px 0 rgba(150, 1, 1, .22) !important;
    }

    .header_contacts {
        padding: 8px 0;
        font-size: 13px;
    }

    .header_contacts_inner {
        justify-content: center;
    }

    .header_contact_links {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .header_contact_links svg {
        width: 17px;
        height: 17px;
    }

    .header_address {
        display: none;
    }

    .header_main {
        min-height: 60px;
        box-sizing: border-box;
        align-items: center;
        padding: 8px 0;
    }

    header .logo {
        position: relative;
        top: auto;
        width: 105px;
        padding: 10px;
        border-radius: 18px;
        z-index: 101;
    }

    header .logo_replacement {
        display: none;
    }

    #main_nav {
        width: 100vw;
        padding: 165px 7vw 35px;
    }

    #main_nav::before {
        display: none;
    }

    .sub_header {
        min-height: 500px;
        height: calc(100svh - 98px);
    }

    .sub_header.reduced {
        height: 330px;
        min-height: 330px;
        max-height: none;
    }

    .sub_header .info {
        width: 90%;
    }

    .sub_header .info > div {
        padding-bottom: 30px;
    }

    .sub_header .info .typed_properties * {
        font-size: 21px;
        line-height: 1.25;
    }

    .sub_header .info > div > div[style*="display: flex"],
    .w_def > div[style*="width: 90%"] > div[style*="display: flex"] {
        flex-wrap: wrap;
        gap: 22px !important;
    }

    .w_def > div[style*="width: 90%"] {
        width: 100% !important;
        float: none !important;
    }

    .cols2,
    .servizi-grid,
    .grid.partners,
    footer .grid,
    .service_gallery {
        grid-template-columns: minmax(0, 1fr);
    }

    .cols2 {
        gap: 35px;
    }

    .cols2.custom_ar > div[style*="padding-left"],
    .cols2.custom_ar > div[style*="padding-right"] {
        width: 90%;
        box-sizing: border-box;
        margin: auto;
        padding: 0 !important;
    }

    .wrap_high_img {
        aspect-ratio: 4 / 3;
    }

    .servizio-card {
        height: 220px;
    }

    .servizio-card-inner,
    .servizio-card:hover .servizio-card-inner {
        transform: none;
        box-shadow: none;
    }

    .servizio-card-back {
        display: none;
    }

    .servizio-card-front img {
        opacity: .72;
    }

    .points {
        --point-width: 100%;
    }

    .points .point:nth-child(n) {
        margin-left: 0;
    }

    .point h3 {
        font-size: 25px;
    }

    .grid.partners {
        gap: 45px;
    }

    .grid.partners > a:not(:last-of-type)::after {
        top: auto;
        right: 0;
        bottom: -23px;
        width: 100%;
        height: 1px;
    }

    .grid.partners figure {
        height: auto;
        min-height: 100px;
    }

    .service_gallery {
        gap: 14px;
    }

    .service_gallery figure[data-effect="gallery-elegant"]:nth-child(n) {
        transition-delay: 0ms;
    }

    .service_gallery figure[data-effect="gallery-elegant"].active:hover {
        transform: none;
    }

    footer .grid {
        gap: 45px;
    }

    footer .flex[style*="justify-content: space-between"] {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .w_def.cols2 p[style*="font-size: 25px"] {
        font-size: 19px !important;
        line-height: 36px !important;
        overflow-wrap: anywhere;
    }

    .w_def.cols2 iframe {
        height: 360px;
    }

    [data-effect="slide-left"],
    [data-effect="slide-right"] {
        transform: translateY(45px);
    }

    [data-effect="slide-left"].active,
    [data-effect="slide-right"].active {
        transform: translateY(0);
    }
}

@media screen and (min-width: 701px) and (max-width: 900px) {
    .header_contacts_inner {
        justify-content: center;
    }

    .header_address {
        display: none;
    }
}

@media (hover: none) {
    .servizio-card-inner,
    .servizio-card:hover .servizio-card-inner {
        transform: none;
    }

    .servizio-card-back {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
