body {
    margin: 0;
    background-color: black;
    color: white;
    font-family: "Century Gothic", sans-serif;
    font-weight: 300;
    letter-spacing: 1px;
    overflow: hidden;
}

#background {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
    filter: brightness(0.85) contrast(1.1) saturate(2.5);
}

.servizi_page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    overflow: hidden;
}

body.is-leaving .servizi_page {
    opacity: 0;
    transition: opacity 0.45s ease;
}

body.is-leaving .header-nav {
    transform: translateY(-100%);
    transition: transform 0.45s ease;
}

/* HEADER-NAV */
.header-nav {
    position: relative;
    z-index: 20;
    background: auto;
    background-color: rgba(255, 255, 255, 0.482);
    backdrop-filter: blur(3px);
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 0 30px;
    box-sizing: border-box;
    animation: slideDown 0.8s ease-out;
}

#logo_header {
    display: block;
    width: 200px;
    height: auto;
    border-radius: 20px;
    margin-left: 100px;
    flex-shrink: 0;
}

/* NAVIGATION */
.header-nav nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
    align-items: center;
}

.header-nav nav li {
    margin: 0;
}

.inactiveLink {
    pointer-events: auto;
    cursor: pointer;
}

.services-menu {
  position: relative;
}

.services-submenu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 2px;
  width: min(360px, calc(100vw - 32px));
    margin: 0;
    min-height: 225px;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid rgb(0, 0, 39);
  border-radius: 12px;
  background-color: rgb(0, 0, 39);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.services-menu:hover .services-submenu,
.services-menu:focus-within .services-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.services-submenu li {
  margin: 0 !important;
}

.header-nav nav .services-submenu a {
  display: block;
  color: lightskyblue;
  padding: 15px 5px;
  border-radius: 7px;
  font-size: 0.86rem;
  line-height: 0.3;
  text-align: center;
  margin-bottom: -30px;
}

.header-nav nav .services-submenu a:hover,
.header-nav nav .services-submenu a:focus-visible {
  background: rgba(184, 228, 231, 0.16);
  opacity: 1;
  transform: none;
}

.services-submenu li:last-child a {
  margin-bottom: 0;
}

@media (max-width: 800px) {
    .services-menu {
        position: static;
    }

    .services-submenu {
        top: 100%;
        left: 50%;
        right: auto;
        grid-template-columns: 1fr;
        width: min(340px, calc(100vw - 32px));
        transform: translate(-50%, -8px);
    }

    .services-menu:hover .services-submenu,
    .services-menu:focus-within .services-submenu {
        transform: translate(-50%, 0);
    }
}

.header-nav nav a {
    text-decoration: none;
    color: white;
    font-size: 1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: block;
}

.header-nav nav a:hover {
    opacity: 0.7;
    transform: scale(1.05);
}

.nav {
    display: flex;
    align-items: center;
    margin-right: 50px;
}

/* CONTENT */
.content {
    min-height: calc(100vh - 150px);
    padding: 44px 30px 60px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    text-align: justify;
    justify-content: center;
}

.services-carousel {
    position: relative;
    width: min(1100px, 100%);
    min-height: 460px;
}

.service-slide {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    align-items: center;
    gap: clamp(30px, 6vw, 80px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0.7s ease;
}

.service-slide.is-active {
    opacity: 1;
    visibility: visible;
}

.service-slide.is-entering {
    z-index: 2;
    animation: serviceEnter 0.7s ease both;
}

.service-slide.is-leaving {
    z-index: 1;
    visibility: visible;
    pointer-events: none;
    animation: serviceLeave 0.7s ease both;
}

.service-slide > img {
    display: block;
    width: 100%;
    height: 460px;
    object-fit: cover;
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.3);
}

.service-copy {
    padding: 34px 38px 38px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 18px;
    background: rgba(12, 24, 35, 0.72);
    backdrop-filter: blur(8px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
}

.service-step {
    margin: 0 0 18px;
    color: #b8e4e7;
    font-size: 0.78rem;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.typewriter-text {
    min-height: 150px;
    margin: 0;
    line-height: 1.7;
    letter-spacing: 0.5px;
}

/* ANIMATIONS */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes slideDown {
  from {
    transform: translateY(-150px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

@keyframes serviceLeave {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-45px);
    }
}

@media (max-width: 800px) {
    body {
        overflow-y: auto;
    }

    .servizi_page {
        overflow: visible;
    }

    .header-nav {
        height: auto;
        min-height: 120px;
        flex-direction: column;
        justify-content: center;
        padding: 20px;
    }

    #logo_header {
        width: min(180px, 70vw);
        margin-left: 0;
    }

    .nav {
        margin-right: 0;
    }

    .header-nav nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 18px;
    }

    .content {
        min-height: auto;
        padding: 30px 16px 45px;
        text-align: justify;
    }

    .services-carousel {
        min-height: 650px;
    }

    .service-slide {
        grid-template-columns: 1fr;
        align-content: center;
        gap: 18px;
    }

    .service-slide > img {
        height: 340px;
    }

    .service-copy {
        padding: 26px 22px 28px;
    }

    .typewriter-text {
        min-height: 125px;
    }
}