@media (max-width: 1100px) {
    header {
        padding: 1.2rem 4% 1.6rem !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .logo img {
        height: 4.2rem !important;
    }

    .menu {
        width: 100% !important;
        max-width: 560px !important;
        justify-content: center !important;
        gap: .6rem !important;
        overflow-x: auto !important;
        scrollbar-width: none;
    }

    .menu::-webkit-scrollbar {
        display: none;
    }

    .menu .link,
    .menu .link.active,
    .menu .link:hover,
    .menu .link:focus-visible {
        width: 52px !important;
        min-width: 52px !important;
        height: 44px !important;
    }

    .menu .link-title {
        display: none !important;
    }

    .menu .link-icon {
        margin-left: 1.45rem !important;
        font-size: 2.15rem !important;
    }

    .home,
    .chi-siamo,
    .services,
    .portfolio-section,
    .contatti {
        padding-top: 15rem !important;
    }

    footer {
        padding-inline: 1.6rem !important;
        line-height: 1.5 !important;
    }
}

@media (min-width: 901px) {
    .chi-right-wrapper .character-left {
        left: -23% !important;
        top: 20% !important;
        width: clamp(16rem, 21vw, 40rem) !important;
        transform: rotate(-2deg) !important;
        z-index: 20 !important;
        opacity: 1 !important;
    }

    .chi-right-wrapper .character-right {
        left: 45% !important;
        right: auto !important;
        top: 45% !important;
        bottom: auto !important;
        width: clamp(28rem, 42vw, 80rem) !important;
        transform: none !important;
        z-index: 20 !important;
        opacity: 1 !important;
    }

    .contatti .character-left {
        left: 27% !important;
        top: 32% !important;
        right: auto !important;
        bottom: auto !important;
        width: clamp(28rem, 36vw, 70rem) !important;
        transform: rotate(-2deg) !important;
        z-index: 10 !important;
        opacity: 1 !important;
    }

    .contatti .character-right {
        left: 89.5% !important;
        right: auto !important;
        top: 38% !important;
        bottom: auto !important;
        width: clamp(10rem, 12vw, 23rem) !important;
        transform: rotate(-2deg) !important;
        z-index: 10 !important;
        opacity: 1 !important;
    }

    .chi-right-wrapper .case-study,
    .contatti .cont-left,
    .contatti .cont-right {
        position: relative !important;
        z-index: 12 !important;
    }
}

@media (max-width: 900px) {
    .home {
        min-height: 100vh !important;
        height: auto !important;
        padding-inline: 6% !important;
        padding-bottom: 5rem !important;
        flex-direction: column !important;
        justify-content: center !important;
        text-align: center !important;
        gap: 3rem !important;
    }

    .home-img,
    .home-content {
        flex: 0 1 auto !important;
        width: 100% !important;
    }

    .home-img {
        justify-content: center !important;
    }

    .home-img img {
        max-width: 280px !important;
        width: min(72vw, 280px) !important;
    }

    .home-content h1,
    .chi-left h1,
    .services h1,
    .portfolio-title,
    .cont-title {
        font-size: clamp(3rem, 9vw, 4.4rem) !important;
        line-height: 1.15 !important;
        letter-spacing: .02em !important;
    }

    .btn,
    .chi-btn a,
    .discord-btn,
    .service-btn {
        width: min(100%, 320px) !important;
        padding-inline: 2rem !important;
        min-height: 50px !important;
        text-align: center !important;
    }

    .chi-siamo {
        flex-direction: column !important;
        text-align: center !important;
        gap: 3rem !important;
        padding-inline: 6% !important;
    }

    .chi-left,
    .chi-right-wrapper {
        flex: 0 1 auto !important;
        width: 100% !important;
    }

    .chi-right-wrapper {
        flex-direction: column !important;
    }

    .chi-left p,
    .cont-text {
        max-width: none !important;
        font-size: 1.6rem !important;
        line-height: 1.7 !important;
    }

    .case-study {
        height: auto !important;
        min-height: 340px !important;
    }

    .case-study-images li .img-hero-background {
        width: 100% !important;
        border-radius: 14px !important;
    }

    .case-study-wrapper {
        top: auto !important;
        bottom: 1rem !important;
        width: calc(100% - 2rem) !important;
        display: flex !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: .6rem !important;
    }

    .case-study-wrapper .case-study-name a {
        font-size: 1.1rem !important;
        letter-spacing: 1px !important;
    }

    .services {
        padding-inline: 6% !important;
    }

    .services h1 {
        margin-bottom: 3.5rem !important;
    }

    .services-grid {
        gap: 2.5rem !important;
    }

    .services-grid a,
    .services-grid a > div {
        width: min(100%, 340px) !important;
    }

    .portfolio-section {
        padding-inline: 5% !important;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        grid-auto-rows: auto !important;
        gap: 1.4rem !important;
    }

    .portfolio-item {
        min-height: 130px !important;
        border-radius: 14px !important;
    }

    .portfolio-item img {
        border-radius: 14px !important;
        max-height: 220px !important;
    }

    #lightbox-img {
        max-width: 92% !important;
        max-height: 78% !important;
    }

    #closeBtn {
        top: 1.2rem !important;
        right: 1.6rem !important;
        font-size: 3.2rem !important;
    }

    #prevBtn,
    #nextBtn {
        font-size: 3.6rem !important;
    }

    .contatti {
        padding-inline: 6% !important;
        gap: 3rem !important;
        text-align: center !important;
    }

    .cont-left,
    .cont-right {
        flex: 1 1 100% !important;
    }

    .cont-right {
        padding: 2.4rem 2rem !important;
        border-radius: 1.6rem !important;
    }

    .form-group {
        text-align: left !important;
    }

    .send-button-wrapper {
        margin-top: 4rem !important;
        margin-bottom: 5rem !important;
    }

    .demo {
        width: min(100%, 300px) !important;
    }

    .character-left,
    .character-right {
        display: none !important;
    }

    .chi-right-wrapper,
    .contatti {
        overflow: visible !important;
    }
}

@media (max-width: 560px) {
    html {
        font-size: 58% !important;
    }

    header {
        padding-inline: 3% !important;
    }

    .menu {
        justify-content: flex-start !important;
        padding: .5rem !important;
    }

    .home,
    .chi-siamo,
    .services,
    .portfolio-section,
    .contatti {
        padding-top: 14rem !important;
    }

    .home-content h1,
    .chi-left h1,
    .services h1,
    .portfolio-title,
    .cont-title {
        font-size: clamp(2.7rem, 10vw, 3.6rem) !important;
    }

    .portfolio-grid {
        grid-template-columns: 1fr !important;
    }

    .portfolio-item {
        min-height: 180px !important;
    }

    .portfolio-item img {
        width: 100% !important;
        max-height: 280px !important;
        object-fit: contain !important;
    }

    .discord-btn {
        font-size: 1.25rem !important;
        letter-spacing: .06em !important;
    }

#cookie-banner {
    width: calc(100% - 2rem) !important;
    bottom: 1rem !important;
        padding: 1.4rem !important;
    }

    #cookie-banner p {
        flex-basis: 100% !important;
        font-size: 1.25rem !important;
    }

    #cookie-banner button {
        width: 100% !important;
        max-width: none !important;
    }
}

#cookie-banner {
    position: fixed;
    left: 50%;
    bottom: 0;
    z-index: 1000;
    width: 90%;
    max-width: 1000px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 1.8rem 2rem;
    border-radius: 1rem 1rem 0 0;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%);
    transition: .5s;
    border: 1px solid rgba(255, 255, 255, .18) !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(255,255,255,.18), rgba(255,255,255,0) 34%),
        rgba(10, 0, 1, .72) !important;
    backdrop-filter: blur(18px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(170%) !important;
}

#cookie-banner.show {
    opacity: 1;
    pointer-events: auto;
    bottom: 20px;
}

#cookie-banner p {
    flex: 1 1 60%;
    margin: 0;
    font-size: 1.4rem;
}

#cookie-banner .cookie-actions {
    display: flex;
    flex: 0 0 auto;
    gap: .8rem;
    align-items: center;
    justify-content: flex-end;
}

#reject-cookies {
    padding: 1rem 2.2rem;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    border-radius: .5rem;
    cursor: pointer;
    max-width: 200px;
    transition: .3s;
}

@media (max-width: 560px) {
    #cookie-banner .cookie-actions {
        width: 100%;
        flex-direction: column-reverse;
    }

#reject-cookies,
#accept-cookies {
    width: 100% !important;
    max-width: none !important;
}
}

#accept-cookies:hover {
    background:
        radial-gradient(circle at 28% 0%, rgba(255,255,255,.62), rgba(255,255,255,0) 35%),
        linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.075) 46%, rgba(57,255,143,.22)),
        rgba(32, 178, 91, .22) !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.86),
        inset 0 -1px 0 rgba(255,255,255,.26),
        inset 0 0 0 1px rgba(255,255,255,.20),
        0 20px 44px rgba(0,0,0,.38),
        0 0 32px rgba(57,255,143,.26) !important;
}

#reject-cookies:hover {
    background:
        radial-gradient(circle at 28% 0%, rgba(255,255,255,.62), rgba(255,255,255,0) 35%),
        linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.075) 46%, rgba(255,91,91,.24)),
        rgba(193, 73, 73, .24) !important;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.86),
        inset 0 -1px 0 rgba(255,255,255,.26),
        inset 0 0 0 1px rgba(255,255,255,.20),
        0 20px 44px rgba(0,0,0,.38),
        0 0 32px rgba(255,91,91,.30) !important;
}

/* Restore original Chi siamo character placement on desktop */
@media (min-width: 901px) {
    .chi-right-wrapper {
        flex-direction: row !important;
        overflow: visible !important;
    }

    .chi-right-wrapper > .character-left {
        position: absolute !important;
        left: -23% !important;
        top: 20% !important;
        right: auto !important;
        bottom: auto !important;
        width: clamp(16rem, 21vw, 40rem) !important;
        transform: rotate(-2deg) !important;
        z-index: 20 !important;
        opacity: 1 !important;
        margin: 0 !important;
    }

    .chi-right-wrapper > .character-right {
        position: absolute !important;
        left: 45% !important;
        top: 45% !important;
        right: auto !important;
        bottom: auto !important;
        width: clamp(28rem, 42vw, 80rem) !important;
        transform: none !important;
        z-index: 20 !important;
        opacity: 1 !important;
        margin: 0 !important;
    }
}

/* Keep the Chi siamo gallery controls above decorative characters */
.chi-right-wrapper .case-study {
    z-index: auto !important;
}

.chi-right-wrapper .case-study-wrapper {
    z-index: 80 !important;
    pointer-events: auto !important;
}

.chi-right-wrapper > .character-left,
.chi-right-wrapper > .character-right {
    pointer-events: none !important;
}

/* Cleaner Chi siamo gallery image rendering */
.case-study {
    height: clamp(500px, 36vw, 590px) !important;
    padding-bottom: 4rem !important;
}

.case-study,
.case-study-images,
.case-study-images li {
    overflow: visible !important;
}

.case-study-images li .img-hero-background {
    width: min(calc(100% - 80px), 920px) !important;
    aspect-ratio: 1920 / 1057 !important;
    top: 47% !important;
    background: rgba(0, 0, 0, .18) !important;
    border: 1px solid rgba(255, 255, 255, .12) !important;
    box-shadow:
        0 18px 38px rgba(0, 0, 0, .42),
        0 0 0 1px rgba(193, 73, 73, .10) !important;
    filter: none !important;
}

.case-study-images li .img-hero-background img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

.case-study-images li.show .img-hero-background {
    filter: none !important;
    box-shadow:
        0 20px 42px rgba(0, 0, 0, .45),
        0 0 0 1px rgba(255, 255, 255, .10) !important;
}

/* Shared frosted-glass buttons */
.btn,
.chi-btn a,
.service-btn,
.discord-btn,
#accept-cookies,
#reject-cookies,
.egg-start,
.egg-reset {
    position: relative !important;
    isolation: isolate !important;
    overflow: hidden !important;
    color: #fff !important;
    text-shadow:
        0 1px 1px rgba(0, 0, 0, .75),
        0 0 12px rgba(0, 0, 0, .42) !important;
    -webkit-text-stroke: .18px rgba(0, 0, 0, .34) !important;
    border: 1px solid rgba(255, 255, 255, .48) !important;
    background:
        radial-gradient(circle at 28% 0%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 35%),
        linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .075) 46%, rgba(255, 255, 255, .15)),
        linear-gradient(135deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .055)),
        rgba(255, 255, 255, .055) !important;
    backdrop-filter: blur(30px) saturate(220%) contrast(112%) brightness(1.08) !important;
    -webkit-backdrop-filter: blur(30px) saturate(220%) contrast(112%) brightness(1.08) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .78),
        inset 0 -1px 0 rgba(255, 255, 255, .20),
        inset 0 0 0 1px rgba(255, 255, 255, .16),
        inset 0 -22px 36px rgba(255, 255, 255, .055),
        0 16px 34px rgba(0, 0, 0, .32),
        0 0 26px rgba(255, 255, 255, .10),
        0 0 30px rgba(193, 73, 73, .18) !important;
}

.btn::before,
.chi-btn a::before,
.service-btn::before,
.discord-btn::before,
#accept-cookies::before,
#reject-cookies::before,
.egg-start::before,
.egg-reset::before {
    content: "" !important;
    position: absolute !important;
    left: 7% !important;
    right: 7% !important;
    top: 7% !important;
    height: 38% !important;
    border-radius: inherit !important;
    background: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .08)) !important;
    filter: blur(.35px) !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.btn::after,
.chi-btn a::after,
.service-btn::after,
.discord-btn::after,
#accept-cookies::after,
#reject-cookies::after,
.egg-start::after,
.egg-reset::after {
    content: "" !important;
    position: absolute !important;
    inset: 0 !important;
    border-radius: inherit !important;
    background:
        linear-gradient(115deg, rgba(255,255,255,0) 0 24%, rgba(255,255,255,.34) 36%, rgba(255,255,255,0) 47%),
        linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.12) 78%) !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

.btn:hover,
.chi-btn a:hover,
.service-btn:hover,
.discord-btn:hover,
#accept-cookies:hover,
#reject-cookies:hover,
.egg-start:hover,
.egg-reset:hover {
    transform: translateY(-2px) scale(1.015) !important;
    filter: brightness(1.12) saturate(1.1) !important;
    border-color: rgba(255, 255, 255, .68) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .86),
        inset 0 -1px 0 rgba(255, 255, 255, .26),
        inset 0 0 0 1px rgba(255, 255, 255, .20),
        0 20px 44px rgba(0, 0, 0, .38),
        0 0 32px rgba(255, 255, 255, .20),
        0 0 36px rgba(255, 91, 91, .24) !important;
}

.discord-btn {
    background:
        radial-gradient(circle at 28% 0%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 35%),
        linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .075) 46%, rgba(180, 188, 255, .16)),
        rgba(88, 101, 242, .12) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .78),
        inset 0 -1px 0 rgba(255, 255, 255, .20),
        inset 0 0 0 1px rgba(255, 255, 255, .16),
        0 16px 34px rgba(0, 0, 0, .32),
        0 0 28px rgba(88, 101, 242, .18) !important;
}

.egg-close,
#closeBtn,
#prevBtn,
#nextBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(255, 255, 255, .52) !important;
    background:
        radial-gradient(circle at 30% 10%, rgba(255,255,255,.60), rgba(255,255,255,0) 38%),
        linear-gradient(180deg, rgba(255,255,255,.24), rgba(255,255,255,.07) 52%, rgba(255,255,255,.13)),
        rgba(255, 255, 255, .075) !important;
    backdrop-filter: blur(28px) saturate(210%) contrast(110%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(210%) contrast(110%) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .78),
        inset 0 0 0 1px rgba(255,255,255,.14),
        0 14px 30px rgba(0, 0, 0, .34),
        0 0 24px rgba(255,255,255,.12) !important;
}

#closeBtn,
#prevBtn,
#nextBtn {
    width: 5.2rem !important;
    height: 5.2rem !important;
    border-radius: 50% !important;
    line-height: 1 !important;
}

.egg-close:hover,
#closeBtn:hover,
#prevBtn:hover,
#nextBtn:hover {
    filter: brightness(1.14) !important;
}

.demo {
    border: 1px solid rgba(255, 255, 255, .48) !important;
    background:
        radial-gradient(circle at 28% 0%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 35%),
        linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .075) 46%, rgba(255, 255, 255, .15)),
        rgba(255, 255, 255, .055) !important;
    backdrop-filter: blur(30px) saturate(220%) contrast(112%) brightness(1.08) !important;
    -webkit-backdrop-filter: blur(30px) saturate(220%) contrast(112%) brightness(1.08) !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .78),
        inset 0 -1px 0 rgba(255, 255, 255, .20),
        inset 0 0 0 1px rgba(255,255,255,.16),
        0 16px 34px rgba(0, 0, 0, .32),
        0 0 26px rgba(255,255,255,.10),
        0 0 30px rgba(193,73,73,.18) !important;
}

.demo__text {
    color: #fff !important;
    text-shadow:
        0 1px 1px rgba(0, 0, 0, .78),
        0 0 12px rgba(0, 0, 0, .46) !important;
    -webkit-text-stroke: .18px rgba(0, 0, 0, .34) !important;
}
