/*
|--------------------------------------------------------------------------
| 1. GENERAL STYLES & RESET
|--------------------------------------------------------------------------
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #E6E6E6;
    color: #171717;
    display: flex;
    min-height: 100vh;
    overflow: hidden; 
    cursor: none;
}

/*
|--------------------------------------------------------------------------
| 2. SIDEBAR LAYOUT
|--------------------------------------------------------------------------
*/

.sidebar {
    width: 300px;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    background-color: #171717;
    color: white;
    border-right: 1px solid #7B68EE;
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
}

/* Logo Area */
.logo-area {
    position: absolute;
    top: 40px;
    left: 30px;
    width: calc(100% - 60px);
    z-index: 10;
}

.logo-branding {
    display: flex;
    align-items: center; 
    justify-content: flex-start;
    gap: 15px; 
    width: 100%;
}

.branding-icon {
    width: 50px; 
    height: auto;
    display: block;
    flex-shrink: 0; 
    filter: invert(95%) sepia(0%) saturate(18%) hue-rotate(149deg) brightness(92%) contrast(96%);
}

.branding-content-right {
    display: flex;
    flex-direction: column;
    width: 100%;
    justify-content: center;
}

.branding-text-column {
    display: flex;
    flex-direction: column; 
    align-items: flex-start; 
    color: #E6E6E6;
    margin-bottom: 15px; 
}

.branding-name {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px; 
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.branding-role {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 10px; 
    letter-spacing: 1px;
    opacity: 0.8;
    white-space: nowrap;
    margin-top: 2px; 
}

.branding-underline {
    width: 100%;
    height: 1px;
    background-color: #E6E6E6;
    opacity: 0.5;
}

/* Language Switch */
.language-switch {
    position: absolute;
    bottom: 40px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 20;
}

.lang-btn {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(230, 230, 230, 0.4);
    cursor: pointer;
    transition: color 0.3s ease;
    text-transform: uppercase;
}

.lang-btn:hover { color: rgba(230, 230, 230, 0.8); }

.lang-btn.active {
    color: #E6E6E6;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.lang-separator {
    font-size: 12px;
    color: rgba(230, 230, 230, 0.4);
}

/* Main Navigation */
.main-nav {
    width: 100%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    justify-content: center; 
}

.main-nav ul { 
    list-style: none; 
    margin: 0; 
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
    width: fit-content; 
    position: relative; 
}

.main-nav li { 
    margin-bottom: 35px; 
    width: 100%; 
}

.main-nav a {
    text-decoration: none;
    color: rgba(230, 230, 230, 0.7);
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 400;
    display: inline-block;
    position: relative;
    transition: all 0.4s ease-in-out;
    text-align: left; 
    padding-bottom: 5px; 
}

.main-nav a::before {
    content: '';
    position: absolute;
    left: -20px; 
    top: 50%;
    transform: translateY(-50%); 
    width: 6px;  
    height: 6px;
    background-color: #E6E6E6;
    border-radius: 50%; 
    opacity: 0; 
    transition: opacity 0.4s ease-in-out;
}

.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;           
    background: #E6E6E6;   
    transform: none;       
    transition: width 0.4s ease-in-out;
}

.main-nav a:hover:not(.active)::after { width: 100%; }
.main-nav a:hover { color: #E6E6E6; }
.main-nav a.active { color: #E6E6E6; font-weight: 600; }
.main-nav a.active::before { opacity: 1; }
.main-nav a.active::after { width: 0; }

/*
|--------------------------------------------------------------------------
| 3. CONTENT CONTAINER
|--------------------------------------------------------------------------
*/

.content {
    margin-left: 300px;
    flex-grow: 1;
    width: calc(100% - 300px);
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-snap-type: y mandatory; 
    scroll-behavior: smooth;
}

.hero-section, .about-section, .contacts-section {
    width: 100%;
    min-height: 100vh;
    padding: 50px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start; 
}

/*
|--------------------------------------------------------------------------
| 4. HERO SECTION
|--------------------------------------------------------------------------
*/

.hero-content {
    max-width: 900px;
    padding: 20px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-content h1 {
    font-size: clamp(3rem, 5vw, 5rem); 
    line-height: 1.1;
    font-weight: 800;
    margin-bottom: 30px;
    min-height: 180px; 
}

/* Text Reveal Animation */
.split-text-reveal { opacity: 1; }
.split-text-reveal span.word {
    opacity: 0;
    display: inline-block;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease; 
    will-change: opacity, transform;
    margin-right: 0.2em;
}
.split-text-reveal.active span.word {
    opacity: 1;
    transform: translateY(0);
}
.split-text-reveal .blinking-dot {
    opacity: 0; 
    display: inline-block;
    transition: opacity 0.8s ease; 
}
.split-text-reveal.active .blinking-dot {
    opacity: 1;
    animation: blink 1s step-end infinite;
}

.hero-watermark {
    position: absolute;
    right: 5%;           
    top: 50%;            
    transform: translateY(-50%); 
    height: 70vh;        
    max-height: 600px;   
    width: auto;         
    z-index: 1;          
    pointer-events: none; 
    opacity: 0;
    transition: opacity 1.5s ease; 
}
.hero-watermark.active { opacity: 0.1; }

.cta-link {
    text-decoration: none;
    color: #171717;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    position: relative;
    padding-bottom: 3px;
    padding-left: 2px;
    transition: color 0.4s ease-in-out;
    margin-top: 20px;
    display: inline-block;
    text-transform: uppercase;
}
.cta-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: #171717;
    transition: width 0.4s ease-in-out;
}
.cta-link:hover::after { width: 100%; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

html[lang="en"] .hero-content h1 {
    font-size: clamp(2.5rem, 4vw, 4.2rem); 
}

/*
|--------------------------------------------------------------------------
| 5. ABOUT & SECTIONS GENERAL
|--------------------------------------------------------------------------
*/

.about-content {
    max-width: 1200px;
    width: 100%;
    padding: 20px;
    z-index: 5;
}

.about-flex-container {
    display: flex;
    align-items: center;
    gap: 50px;
    width: 100%;
}

.about-text-wrapper { flex: 1.5; }
.about-image-wrapper { flex: 1; align-self: center; }

.portrait-img { 
    width: 100%; 
    max-width: 320px; 
    height: auto; 
    display: block; 
}

.about-title, .contacts-title {
    font-size: clamp(2.5rem, 4vw, 4rem);
    line-height: 1.1;
    font-weight: 800;
    color: #171717;
    margin-bottom: 30px;
    text-transform: uppercase;
}

.about-content p {
    font-size: clamp(0.9rem, 1.1vw, 1.1rem);
    line-height: 1.6;
    margin-bottom: 15px;
    font-weight: 400;
    max-width: 600px;
}

#servizi .about-text-wrapper,
#servizi .about-content p {
    max-width: 100% !important; 
    padding-right: 0;
}
#servizi .about-content {
    padding-right: 40px; 
}

/*
|--------------------------------------------------------------------------
| 6. SERVICES CARDS
|--------------------------------------------------------------------------
*/

.cards-container {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 900px; 
    padding-top: 20px;
    padding-bottom: 20px;
}

.service-card {
    flex: 0 1 280px; 
    position: relative;
    aspect-ratio: 1 / 1; 
    background-color: #000;
    overflow: hidden; 
    transition: transform 0.4s ease;
}

.service-card .bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    object-fit: cover;
    opacity: 0.9;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.service-card:hover .bg { transform: scale(1.05); }

.service-card .card-gif {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 70px; 
    height: 70px; 
    z-index: 5;
    object-fit: cover;
}

.service-card .card-title {
    position: absolute;
    top: 15px; 
    left: 15px; 
    z-index: 10;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 700; 
    font-size: 32px; 
    line-height: 1.1;
    letter-spacing: -0.03em;
    text-align: left;
    color: #ffffff;
    text-transform: lowercase; 
}

.service-card .card-desc {
    position: absolute;
    bottom: 25px; 
    left: 15px; 
    z-index: 10;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 400; 
    font-size: 13px; 
    line-height: 1.3;
    color: #ffffff;
    width: 140px; 
}

.service-card .card-cta-vertical {
    position: absolute;
    z-index: 20;
    right: 10px; 
    bottom: 100px; 
    font-family: 'Inter', sans-serif;
    font-weight: 700; 
    font-size: 13px; 
    line-height: 1;
    color: #ffffff;
    white-space: nowrap; 
    cursor: pointer;
    transform-origin: bottom right;
    transform: rotate(-90deg);
    padding-bottom: 5px; 
}

html[lang="en"] .service-card .card-cta-vertical {
    bottom: 120px; 
}

.service-card .card-cta-vertical::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0; 
    width: 0;
    height: 2px;
    background-color: #ffffff;
    transition: width 0.3s ease-in-out;
}
.service-card .card-cta-vertical:hover::after { width: 100%; }

/* Card Animations */
@keyframes blink-anim { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes blink-border { 0%, 100% { border-color: #ffffff; } 50% { border-color: transparent; } }

.blink-underscore { animation: blink-anim 1s step-end infinite; }
.blink-dot { animation: blink-anim 0.7s step-end infinite; animation-delay: -0.3s; }
.blink-underline {
    border-bottom: 3px solid #ffffff;
    display: inline-block;
    line-height: 0.8;
    animation: blink-border 1.4s step-end infinite; 
    animation-delay: -0.8s; 
}

/* |--------------------------------------------------------------------------
| 7. CONTACTS GRID
|--------------------------------------------------------------------------
*/

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px 10px; 
    width: 100%;
    max-width: 100%; 
    margin-top: 40px;
}

.contact-item {
    display: flex;
    flex-direction: column;
    align-items: center; 
    text-decoration: none;
    color: #171717;
    justify-self: start; 
    width: 100px; 
}

.contact-item img {
    width: 70px; 
    height: 70px;
    object-fit: contain;
    margin-bottom: 10px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block; 
}
.contact-item:hover img { transform: scale(1.15); }

.contact-label {
    font-size: 14px;
    font-weight: 700; 
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 3px;
    text-align: center;
    white-space: nowrap; 
}
.contact-label::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px; 
    background: #171717;
    transition: width 0.4s ease-in-out;
}
.contact-item:hover .contact-label::after { width: 100%; }

/*
|--------------------------------------------------------------------------
| 8. MODAL COMPONENTS
|--------------------------------------------------------------------------
*/
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6); z-index: 1000;
    display: flex; 
    align-items: center; 
    justify-content: flex-start; 
    padding: 50px 50px 50px 350px; 
    opacity: 0; visibility: hidden; transition: 0.3s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-content {
    background-color: #171717; 
    color: #E6E6E6; 
    padding: 60px;
    width: 100%; 
    max-width: 1200px; 
    height: 100%; 
    overflow: hidden; 
    transform: scale(0.95); transition: 0.3s; 
    margin: 0; 
    border-radius: 0; 
    position: relative; 
    display: flex;
    flex-direction: column;
}

#modal-dynamic-body {
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.modal-overlay.open .modal-content { transform: scale(1); }

.modal-close { 
    position: absolute; top: 20px; right: 20px; 
    color: #E6E6E6; font-size: 1.5rem; cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease; 
    z-index: 100;
}
.modal-close:hover {
    transform: rotate(90deg);
    color: #ffffff; 
}
.content.modal-open-lock { overflow-y: hidden; }

/* Modal Inner Layout */
.modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 40px;
}

.modal-text-col {
    flex: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    padding-right: 20px;
    height: 100%;
    overflow-y: auto;
}

.modal-custom-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700; 
    font-size: 64px;
    line-height: 1.1;
    color: #FFFFFF; 
    margin-bottom: 30px;
    text-transform: lowercase; 
}

.modal-custom-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400; 
    font-size: 20px;
    line-height: 1.5;
    color: #E6E6E6;
}

.modal-custom-title .blink-underline { border-bottom-width: 4px; } 

.modal-img-col {
    flex: 0 0 35%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center; 
    justify-content: flex-start;
}

.modal-img-col img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    display: block;
}

/*
|--------------------------------------------------------------------------
| 9. MARQUEE & HEADERS
|--------------------------------------------------------------------------
*/

.gallery-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 750px; 
    gap: 30px;
    margin-bottom: 30px;
}

.about-header-wrapper, 
.services-header-wrapper, 
.contacts-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px; 
    gap: 30px;
    margin-bottom: 30px;
}

.marquee-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.marquee-content {
    display: flex;
    white-space: nowrap;
    width: max-content;
    animation: marquee-scroll 15s linear infinite;
}

.marquee-content span {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: rgba(23, 23, 23, 0.8);
    display: inline-block;
    margin-right: 5px; 
}

@keyframes marquee-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/*
|--------------------------------------------------------------------------
| 10. GALLERY CAROUSEL
|--------------------------------------------------------------------------
*/

.carousel-wrapper {
    width: 100%;
    max-width: 750px; 
    margin: 20px auto 20px 0; 
    padding-bottom: 20px;
    box-sizing: border-box;
}

.carousel {
    display: block;
    text-align: left;
    position: relative;
    margin-bottom: 10px;
}

.carousel > input { display: none; }
.carousel > input:nth-of-type(6):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: -500%; }
.carousel > input:nth-of-type(5):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: -400%; }
.carousel > input:nth-of-type(4):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: -300%; }
.carousel > input:nth-of-type(3):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: -200%; }
.carousel > input:nth-of-type(2):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: -100%; }
.carousel > input:nth-of-type(1):checked ~ .carousel__slides .carousel__slide:first-of-type { margin-left: 0%; }
.carousel > input:nth-of-type(1):checked ~ .carousel__thumbnails li:nth-of-type(1) { box-shadow: 0px 0px 0px 3px #171717; }
.carousel > input:nth-of-type(2):checked ~ .carousel__thumbnails li:nth-of-type(2) { box-shadow: 0px 0px 0px 3px #171717; }
.carousel > input:nth-of-type(3):checked ~ .carousel__thumbnails li:nth-of-type(3) { box-shadow: 0px 0px 0px 3px #171717; }
.carousel > input:nth-of-type(4):checked ~ .carousel__thumbnails li:nth-of-type(4) { box-shadow: 0px 0px 0px 3px #171717; }
.carousel > input:nth-of-type(5):checked ~ .carousel__thumbnails li:nth-of-type(5) { box-shadow: 0px 0px 0px 3px #171717; }
.carousel > input:nth-of-type(6):checked ~ .carousel__thumbnails li:nth-of-type(6) { box-shadow: 0px 0px 0px 3px #171717; }

.carousel__slides {
    position: relative;
    z-index: 1;
    padding: 0;
    margin: 0;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
    display: flex;
}

.carousel__slide {
    position: relative;
    display: block;
    flex: 1 0 100%;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transition: margin-left 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-sizing: border-box;
    white-space: normal;
}
.carousel__slide figure {
    display: flex;
    margin: 0;
    flex-direction: row; 
    align-items: flex-start;
}

/* FIX IMMAGINI GALLERY */
.img-container { 
    position: relative; 
    width: 65%; 
    flex-shrink: 0; 
    background-color: #171717; 
}
.img-container::before { display: block; content: ""; width: 100%; padding-top: 56.25%; }
.img-container > img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
}

.carousel__slide figcaption { 
    padding: 0 0 0 15px; 
    flex: 1 1 auto; 
    width: 35%; 
    color: #171717; 
    font-family: 'Inter', sans-serif; 
    font-size: 0.85rem; 
    font-weight: 500; 
    line-height: 1.3; 
    white-space: normal; 
}

.gallery-link {
    display: inline-block;
    margin-top: 10px; 
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: #171717;
    border-bottom: 1px solid #171717;
    transition: opacity 0.3s;
}
.gallery-link:hover { opacity: 0.6; }

.carousel__thumbnails { list-style: none; padding: 0; margin: 10px -5px 0 -5px; display: flex; justify-content: flex-start; flex-wrap: wrap; }
.carousel__thumbnails li { flex: 1 1 auto; max-width: calc((100% / 6) - 10px); margin: 0 5px; transition: all 300ms ease-in-out; box-sizing: border-box; }
.carousel__thumbnails label { display: block; cursor: pointer; }
.thumb-container { position: relative; width: 100%; }
.thumb-container::before { display: block; content: ""; width: 100%; padding-top: 100%; }
.thumb-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

.cta-container { display: flex; gap: 20px; flex-wrap: wrap; }
.mobile-nav-toggle { display: none; } 
.mobile-top-bar { display: none; }

/*
|--------------------------------------------------------------------------
| 11. REVEAL ANIMATIONS
|--------------------------------------------------------------------------
*/
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }

/*
|--------------------------------------------------------------------------
| 12. SCROLL CIRCLE BUTTON
|--------------------------------------------------------------------------
*/
.scroll-circle-container {
    position: fixed; 
    bottom: 20px; 
    right: 40px;
    width: 100px; 
    height: 100px;
    z-index: 900; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.3s ease;
}
.scroll-circle-container.visible { opacity: 1; visibility: visible; pointer-events: all; }
.scroll-circle-container.hidden { opacity: 0 !important; pointer-events: none !important; }
.scroll-circle-container:hover { transform: scale(1.1); }
.rotating-text { position: absolute; width: 100%; height: 100%; top: 0; left: 0; will-change: transform; }
.static-arrow { position: relative; width: 30%; height: auto; z-index: 2; }
@media (max-width: 768px) {
    .scroll-circle-container { width: 80px; height: 80px; bottom: 15px; right: 35px; }
}

/*
|--------------------------------------------------------------------------
| 13. CUSTOM CURSOR
|--------------------------------------------------------------------------
*/
#cursor-dot {
    width: 6px; height: 6px; background-color: white;
    position: fixed; top: 0; left: 0; transform: translate(-50%, -50%);
    border-radius: 50%; z-index: 9999; pointer-events: none;
    mix-blend-mode: difference; 
}
#cursor-outline {
    width: 40px; height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5); 
    position: fixed; top: 0; left: 0; transform: translate(-50%, -50%);
    border-radius: 50%; z-index: 9998; pointer-events: none;
    mix-blend-mode: difference;
    transition: width 0.3s ease-out, height 0.3s ease-out, background-color 0.3s, border-color 0.3s;
}
body.hovering #cursor-outline {
    width: 60px; height: 60px;
    background-color: rgba(255, 255, 255, 0.1); 
    border-color: transparent; 
}
body.hovering #cursor-dot { opacity: 0; }

@media (max-width: 1024px) {
    #cursor-dot, #cursor-outline { display: none; }
    body { cursor: auto; }
}

/*
|--------------------------------------------------------------------------
| 14. PRELOADER
|--------------------------------------------------------------------------
*/
#preloader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #E6E6E6; z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}
.loader-wrapper {
    position: relative; width: 100px; height: 100px;
    display: flex; justify-content: center; align-items: center;
}
.spinner {
    position: absolute; width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid transparent; 
    border-top: 2px solid #171717; 
    animation: spin 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite; 
}
.spinner::after {
    content: '';
    position: absolute; top: 10px; left: 10px; right: 10px; bottom: 10px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-bottom: 2px solid rgba(23, 23, 23, 0.4); 
    animation: spin 2s linear infinite reverse; 
}
.loader-logo {
    width: 25px; height: auto; z-index: 10001;
    filter: invert(7%) sepia(0%) saturate(1%) hue-rotate(324deg) brightness(96%) contrast(92%);
    animation: pulse-logo 2s ease-in-out infinite; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse-logo { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(0.95); } }
.loaded #preloader { opacity: 0; visibility: hidden; }

/*
|--------------------------------------------------------------------------
| 15. SPEED LINES ANIMATION
|--------------------------------------------------------------------------
*/

#rain-container {
    position: fixed;
    top: 0;
    left: 300px; /* Rispetta la sidebar */
    width: calc(100% - 300px);
    height: 100vh;
    z-index: -1; 
    pointer-events: none;
    overflow: hidden;
}

.speed-line {
    position: absolute;
    width: 1px; 
    background: linear-gradient(to bottom, transparent, #171717);
    opacity: 0; 
    border-radius: 2px;
    will-change: transform, opacity;
    animation: fall linear forwards;
}

@keyframes fall {
    0% { transform: translateY(-100px); opacity: 0; }
    10% { opacity: 0.15; }
    100% { transform: translateY(300px); opacity: 0; }
}

@media (max-width: 1024px) {
    #rain-container { display: none; }
}

/*
|--------------------------------------------------------------------------
| 16. MEDIA QUERIES & RESPONSIVE LAYOUT
|--------------------------------------------------------------------------
*/

/* --- DESKTOP TWEAKS (1025px - 1400px) --- */
@media (max-width: 1400px) {
    .hero-content h1 { font-size: 3.5rem; }
    .about-title { font-size: 3rem; }
    .hero-section, .about-section, .contacts-section { padding: 30px; }
    .cards-container { gap: 10px; }
    .service-card { flex: 0 1 240px; }
}

@media (max-height: 800px) {
    .main-nav li { margin-bottom: 25px; }
    .hero-content h1 { margin-bottom: 15px; }
    .about-content { padding: 10px; }
}

/* =============================================
   TABLET & IPAD (1024px and below)
   =============================================
*/
@media (max-width: 1024px) {

    /* Body & Layout */
    body { overflow: hidden; }
    
    .content {
        margin-left: 0;
        width: 100%;
        height: 100dvh; 
        overflow-y: auto;
        scroll-snap-type: y mandatory; 
        scroll-behavior: smooth;
        padding-top: 70px; /* Reduced from 100px to match smaller navbar */
    }

    .hero-section, .about-section, .contacts-section {
        min-height: 100dvh; 
        /* Removed height: 100dvh constraint to allow content to grow */
        scroll-snap-align: start;
        padding: 20px;
        display: flex;
        align-items: center; 
        justify-content: center; 
    }

    .about-content {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 0;
    }

    /* Navbar / Header */
    .mobile-top-bar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px; /* Ridotta altezza navbar */
        background-color: #171717; 
        z-index: 500;
        align-items: center;
        justify-content: center; 
        padding: 0 20px;
        box-shadow: 0 1px 10px rgba(0,0,0,0.3);
    }

    .mobile-logo-container {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-logo-icon {
        width: auto;      
        height: 45px;     
        display: block;
        filter: invert(95%) sepia(0%) saturate(18%) hue-rotate(149deg) brightness(92%) contrast(96%);
    }

    .mobile-nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        position: absolute;
        right: 20px; 
        top: 50%;
        transform: translateY(-50%);
        width: 30px; 
        height: 22px;
        cursor: pointer;
        z-index: 501;
    }

    .mobile-nav-toggle .bar {
        width: 100%;
        height: 2px; 
        background-color: #FFFFFF; 
        border-radius: 2px;
        transition: 0.3s;
    }

    .mobile-nav-toggle.active .bar:nth-child(1) { transform: translateY(10px) rotate(45deg); }
    .mobile-nav-toggle.active .bar:nth-child(2) { opacity: 0; }
    .mobile-nav-toggle.active .bar:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }
    
    .sidebar {
        width: 100%;
        height: 100dvh;
        left: 0;
        border: none;
        transform: translateX(100%); 
        background-color: #171717;
        z-index: 400; 
        padding-top: 80px; /* Ridotto padding per matchare navbar */
        justify-content: flex-start;
        transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    }
    .sidebar.mobile-active { transform: translateX(0); }
    .logo-area { display: none; } 
    .language-switch { margin-top: auto; padding-bottom: 40px; position: static; }

    /* General Alignments (Left Aligned for Tablet) */
    .about-section {
        align-items: center; 
        justify-content: center;
        padding-left: 40px; 
        padding-right: 40px;
    }

    #servizi .about-content,
    #gallery .about-content {
        padding-right: 0 !important;
        padding-left: 0 !important;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .about-flex-container { 
        flex-direction: row; 
        align-items: center;
        justify-content: space-between; 
        gap: 40px; 
        padding: 0; 
        width: 100%;
    }

    .about-text-wrapper { flex: 1; min-width: 45%; text-align: left; }
    .about-image-wrapper { display: block; flex: 1; max-width: 45%; text-align: right; height: auto; max-height: 50vh; overflow: visible; }
    
    /* Headers Left */
    #servizi .about-text-wrapper,
    #gallery .about-text-wrapper {
        flex: 0 0 100%; 
        max-width: 100%;
        text-align: left; 
        margin-bottom: 30px;
    }
    
    #servizi .about-flex-container,
    #gallery .about-flex-container {
        justify-content: flex-start;
        align-items: flex-start;
        flex-direction: column;
        padding: 0;
        width: 100%;
    }

    .gallery-header-wrapper, 
    .services-header-wrapper,
    .about-header-wrapper {
        margin: 0 0 30px 0; 
        justify-content: flex-start;
        max-width: 100%;
    }

    /* Contacts */
    #contatti.about-section {
        display: flex; flex-direction: column; justify-content: center; 
        min-height: 100dvh; 
        padding-top: 80px; 
        padding-bottom: 40px;
        align-items: flex-start;
    }
    .contacts-grid { margin: 0; }

    /* --- CARDS HORIZONTAL SCROLL (CRITICAL) --- */
    .cards-container {
        display: flex;
        flex-wrap: nowrap;       
        overflow-x: auto;        
        justify-content: flex-start;
        width: calc(100% + 40px);
        margin-left: 0;
        margin-right: -40px;     
        padding-left: 0;         
        padding-right: 40px;     
        gap: 20px; 
        scroll-snap-type: x mandatory; 
        -webkit-overflow-scrolling: touch; 
        scrollbar-width: none;   
    }
    .cards-container::-webkit-scrollbar { display: none; }

    .service-card {
        flex: 0 0 280px;         
        width: 280px;
        height: auto;
        aspect-ratio: 1 / 1;
        scroll-snap-align: start; 
        margin-right: 0;
    }

    /* Modal Fixes for Tablet */
    .modal-overlay { padding: 0 !important; }
    .modal-content { width: 85vw; height: 70vh; padding: 40px; margin: auto; }
    .modal-layout { flex-direction: row; align-items: center; }

    /* Gallery Alignment */
    .carousel-wrapper { width: 100%; max-width: 700px; margin: 0 0 20px 0 !important; padding-bottom: 20px; }
    .carousel__thumbnails { display: flex; justify-content: flex-start; }
}

/* =============================================
   MOBILE PHONES (<= 768px)
   =============================================
*/
@media (max-width: 768px) {
    
    /* Layout Adjustments */
    #servizi.about-section {
        height: auto; 
        min-height: 100dvh; /* Allows scrolling if content is tall */
        align-items: flex-start; 
        justify-content: flex-start;
        padding-top: 120px; 
        padding-bottom: 40px;
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .about-section, .contacts-section { padding-left: 20px; padding-right: 20px; }
    
    /* Reduced spacing for services on mobile */
    #servizi .about-content p {
        margin-bottom: 5px; 
    }
    
    #servizi .about-content { height: auto; justify-content: flex-start; gap: 0px; }
    #servizi .cards-container { 
        margin-top: 0px; 
        width: calc(100% + 20px); margin-right: -20px; padding-right: 20px; 
    }

    /* Hide Desktop Elements */
    .about-image-wrapper, .portrait-img { display: none; }
    
    /* Typography */
    .hero-content h1 { font-size: 2.5rem; margin-top: 0; }
    .about-title, .contacts-title { font-size: 2.2rem; margin-bottom: 15px; }
    .about-content p { font-size: 0.95rem; max-width: 100%; }

    /* Mobile Service Cards - OPTIMIZED FOR IPHONE 11 */
    .service-card {
        flex: 0 0 260px; /* Fixed width, not VW to avoid massive cards */
        width: 260px;
        height: 300px; /* Fixed height, slightly taller than wide */
        max-width: none;
        max-height: none;
        aspect-ratio: auto; /* Remove aspect ratio constraint */
        overflow: hidden !important; /* FIX: Taglia il contenuto extra */
        touch-action: pan-x;         /* FIX: Permette solo lo scroll orizzontale, passa quello verticale al body */
    }
    
    /* Fix Card Text Size on Mobile */
    .service-card .card-title { font-size: 24px; top: 20px; left: 20px; }
    .service-card .card-desc { width: 90%; font-size: 14px; bottom: 60px; left: 20px; }
    .service-card .card-gif { width: 60px; height: 60px; }
    
    /* Fix "Discover More" Button for Thumbs */
    .service-card .card-cta-vertical {
        transform: none; /* No rotation */
        bottom: 20px;
        right: auto;
        left: 20px;
        writing-mode: horizontal-tb;
        font-size: 12px;
        padding-bottom: 2px;
    }
    html[lang="en"] .service-card .card-cta-vertical { bottom: 20px; }
    
    /* Gallery Mobile Fixes */
    .carousel-wrapper { width: 100vw; margin-left: -20px !important; }
    
    .carousel__slides {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 15px;
        padding: 0 20px;
        width: 100%;
        position: static;
        height: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .carousel__slides::-webkit-scrollbar { display: none; }
    
    .carousel__slide {
        position: static;
        flex: 0 0 85vw; 
        width: 85vw;
        margin-left: 0 !important;
        opacity: 1;
        scroll-snap-align: center;
    }
    .carousel__slide figure { flex-direction: column; }
    .img-container { width: 100%; margin-bottom: 10px; }
    .carousel__slide figcaption { width: 100%; padding: 0; }
    .carousel__thumbnails { display: none; }

    /* Modal Mobile */
    .modal-content { padding: 80px 20px 30px 20px; height: 100%; border-radius: 0; }
    .modal-layout { flex-direction: column; gap: 20px; }
    .modal-text-col { padding: 0; height: auto; display: block; }
    .modal-custom-title { font-size: 2.2rem; margin-bottom: 20px; }
    .modal-custom-text { font-size: 1rem; }
    .modal-img-col { display: none; }
    
    /* Grid Mobile - ICONE E SPAZIATURA CONTATTI */
    #contatti.about-section {
        padding-top: 100px; /* Assicura spazio dall'header */
    }
    
    .contacts-grid { 
        grid-template-columns: repeat(3, 1fr); 
        gap: 20px 10px; 
        margin-top: 40px; /* CHANGE: Aggiunge spazio tra testo e icone */
    }
    
    .contact-item img {
        width: 55px; /* CHANGE: Aumentato da 40px a 55px per visibilità */
        height: 55px;
    }
    .contact-label { font-size: 10px; } /* Smaller label */

    /* Gallery Header Fix */
    .gallery-header-wrapper, 
    .about-header-wrapper,
    .services-header-wrapper,
    .contacts-header-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .marquee-container { width: 100%; }
}

/* =============================================
   SMALL DEVICES FIX (iPhone SE, etc. <= 380px)
   =============================================
*/
@media (max-width: 380px) {
    .hero-content h1 { font-size: 2rem; }
    .about-title, .contacts-title { font-size: 1.8rem; }
    .about-content p { font-size: 0.85rem; }
    
    /* Adjust Cards for small screens */
    .service-card { flex: 0 0 240px; width: 240px; }
    .contacts-grid { grid-template-columns: repeat(2, 1fr); }
    
    /* Adjust Modal Padding */
    .modal-content { padding: 70px 15px 20px 15px; }
    .modal-custom-title { font-size: 1.8rem; }
}

/*
|--------------------------------------------------------------------------
| LEGAL AREA (SIDEBAR)
|--------------------------------------------------------------------------
*/
.legal-area {
    position: absolute;
    bottom: 15px; /* Appena sotto il language switch */
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 20;
}

.legal-link {
    font-family: 'Inter', sans-serif;
    font-size: 9px; /* Molto piccolo */
    text-transform: uppercase;
    color: rgba(230, 230, 230, 0.3); /* Molto tenue */
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: color 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}

.legal-link:hover {
    color: rgba(230, 230, 230, 0.8);
    text-decoration: underline;
}

/* Adattamento Mobile Sidebar */
@media (max-width: 1024px) {
    .legal-area {
        position: relative;
        bottom: auto;
        margin-top: 20px;
        padding-bottom: 20px;
    }
}

/* Stile Contenuto Privacy nella Modale */
.privacy-content-wrapper {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
}

.privacy-content-wrapper h2 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    margin-bottom: 20px;
    color: #ffffff;
}

.privacy-content-wrapper h3 {
    font-size: 16px;
    margin-top: 25px;
    margin-bottom: 10px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.privacy-content-wrapper p, 
.privacy-content-wrapper ul {
    font-size: 13px;
    line-height: 1.6;
    color: #cccccc;
    margin-bottom: 10px;
}

.privacy-content-wrapper ul {
    padding-left: 20px;
}
.privacy-content-wrapper li {
    margin-bottom: 5px;
}

.privacy-logo {
    width: 60px;
    height: auto;
    display: block;
    margin-bottom: 30px;
    /* Inverte i colori per renderlo bianco su sfondo scuro, come nella sidebar */
    filter: invert(95%) sepia(0%) saturate(18%) hue-rotate(149deg) brightness(92%) contrast(96%);
}

/*
|--------------------------------------------------------------------------
| TWEAK: ICONE PIÙ PICCOLE SU MOBILE
|--------------------------------------------------------------------------
*/
@media (max-width: 768px) {
    
    /* 1. Riduci Hamburger Menu (e la X del menu) */
    .mobile-nav-toggle {
        width: 30px !important;
        height: 22px !important;
    }

    /* Linee più sottili per eleganza */
    .mobile-nav-toggle .bar {
        height: 2px !important;
    }

    /* Aggiusta la rotazione della X per le nuove dimensioni */
    .mobile-nav-toggle.active .bar:nth-child(1) { 
        transform: translateY(10px) rotate(45deg) !important; 
    }
    .mobile-nav-toggle.active .bar:nth-child(3) { 
        transform: translateY(-10px) rotate(-45deg) !important; 
    }

    /* 2. Riduci la X di chiusura delle Modali (Privacy/Servizi) */
    .modal-close {
        font-size: 1.2rem !important;
        top: 15px !important;
        right: 15px !important;
    }
}

/* |--------------------------------------------------------------------------
| ULTIMATE FIX: IPHONE SE & MICRO DEVICES (< 375px)
|--------------------------------------------------------------------------
*/
@media (max-width: 375px) {

    /* 1. Recuperiamo spazio laterale */
    .hero-section, 
    .about-section, 
    .contacts-section {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    #servizi.about-section {
        padding-left: 15px !important;
        padding-right: 0 !important; /* Per lo scroll orizzontale */
    }

    /* 2. Tipografia più compatta */
    .hero-content h1 {
        font-size: 1.9rem !important; /* Leggermente più piccolo */
        margin-bottom: 20px;
    }

    .about-title, 
    .contacts-title {
        font-size: 1.8rem !important;
    }

    .about-content p, 
    .modal-custom-text {
        font-size: 0.85rem !important;
        line-height: 1.5;
    }

    /* 3. Service Cards più piccole e proporzionate */
    .service-card {
        flex: 0 0 230px !important; /* Ridotto da 260px */
        width: 230px !important;
        height: 230px !important; /* Torniamo quadrati per risparmiare altezza */
    }

    .service-card .card-title {
        font-size: 20px !important;
        top: 15px;
        left: 15px;
    }

    .service-card .card-desc {
        font-size: 12px !important;
        bottom: 40px !important; /* Alziamo un po' */
        left: 15px;
    }
    
    .service-card .card-cta-vertical {
        bottom: 15px !important;
        left: 15px !important;
        font-size: 10px !important;
    }

    /* 4. Contatti: Forziamo 3 colonne compatte (invece di 2) per salvare spazio verticale */
    .contacts-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 15px 5px !important; /* Meno spazio tra gli elementi */
    }

    .contact-item img {
        width: 40px !important; /* Icone più piccole */
        height: 40px !important;
    }
    
    .contact-label {
        font-size: 8px !important;
        letter-spacing: 0.5px;
    }

    /* 5. Modale ottimizzata per schermi corti */
    .modal-content {
        padding: 60px 15px 15px 15px !important;
        width: 90vw !important;
        height: 80vh !important; /* Evita che esca dallo schermo se il telefono è basso */
    }

    .modal-custom-title {
        font-size: 1.6rem !important;
        margin-bottom: 15px;
    }

    .modal-close {
        top: 10px !important;
        right: 10px !important;
    }

    /* 6. Gallery */
    .gallery-header-wrapper {
        margin-bottom: 15px !important;
    }
    
    .img-container {
        margin-bottom: 5px !important;
    }
    
    .carousel__slide figcaption {
        font-size: 0.8rem !important;
    }
}