/* =====================
   RESET E VARIABILI
   ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
:root {
    --primary: #d32f2f; /* Rosso aziendale */
    --primary-light: #e53935; /* Rosso chiaro per hover */
    --accent: #b71c1c; /* Rosso scuro per enfasi */
    --bg: #f8f9fa; /* Grigio chiaro per sfondi */
    --bg-dark: #ececec; /* Grigio medio per sezioni */
    --text: #181a1b; /* Nero per testi principali */
    --text-light: #6c757d; /* Grigio per testi secondari */
    --white: #fff;
    --black: #181a1b;
    --shadow: 0 2px 16px 0 rgba(30,41,59,0.08);
    --radius: 16px;
    --transition: 0.2s cubic-bezier(.4,0,.2,1);
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Roboto', sans-serif;
    --section-padding: 80px 0;
    --container-max-width: 1200px;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    font-size: 18px;
}
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* =====================
   TIPOGRAFIA E LINK
   ===================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text);
    margin-bottom: 0.5em;
    font-weight: 800;
}
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
p {
    margin-bottom: 1em;
}
a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--primary-light);
}
.text-white {
    color: var(--white);
}
.text-center {
    text-align: center;
}
.mt-5 {
    margin-top: 3rem !important;
}

/* =====================
   SEZIONI E SFONDI
   ===================== */
.section-padding {
    padding: var(--section-padding);
}
.bg-light {
    background-color: var(--bg-dark);
}
.bg-dark {
    background-color: var(--text);
    color: var(--white);
}
.bg-dark h2, .bg-dark h3 {
    color: var(--white);
}
.bg-primary {
    background-color: var(--primary);
    color: var(--white);
}
.bg-primary h2, .bg-primary p {
    color: var(--white);
}

/* =====================
   BOTTONI
   ===================== */
.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-text {
    display: inline-block;
    padding: 0.75em 2em;
    border-radius: var(--radius);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    background: var(--primary);
    color: var(--white);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
}
.btn:hover, .btn-primary:hover, .btn-secondary:hover {
    background: var(--primary-light);
    color: var(--white);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 4px 24px 0 rgba(37,99,235,0.12);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    box-shadow: none;
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}
.btn-text {
    background: none;
    color: var(--primary);
    box-shadow: none;
    padding: 0.5em 1em;
}
.btn-text:hover {
    text-decoration: underline;
    background: var(--primary-light);
    color: var(--white);
}

/* =====================
   ICONE
   ===================== */
.icon-large {
    font-size: 3em;
    color: var(--primary);
    margin-bottom: 15px;
}

/* =====================
   HEADER E NAVIGAZIONE
   ===================== */
.main-header {
    background-color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(30,41,59,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.main-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo img {
    height: 80px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(30,41,59,0.10);
}
.main-nav {
    display: flex;
    align-items: center;
}
.main-nav ul {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
.main-nav ul li {
    margin-left: 30px;
}
.main-nav ul li a {
    font-weight: 600;
    color: var(--text);
    position: relative;
    padding: 5px 0;
    transition: color var(--transition);
}
.main-nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary);
    left: 0;
    bottom: 0;
    transition: width var(--transition);
}
.main-nav ul li a:hover::after,
.main-nav ul li a.active::after {
    width: 100%;
}
.header-cta {
    margin-left: 30px;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    position: relative;
    width: 30px;
    height: 20px;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}
.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: var(--text);
    border-radius: 5px;
    transition: all var(--transition);
}
.menu-toggle.active .bar:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
}
.menu-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active .bar:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
}

/* =====================
   FOOTER
   ===================== */
.main-footer {
    background-color: var(--text);
    color: var(--white);
    padding: 40px 0 15px 0;
    font-size: 0.95em;
    border-radius: 0;
    box-shadow: none;
}
.main-footer h4 {
    color: var(--white);
    font-size: 1.1em;
    margin-bottom: 18px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    justify-items: center;
}
.footer-about, .footer-links, .footer-contact {
    text-align: center;
}
.footer-about p, .footer-contact p {
    color: #cccccc;
    font-size: 1em;
    margin-bottom: 16px;
}
.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links ul li {
    margin-bottom: 8px;
}
.footer-links ul li a {
    color: #cccccc;
    font-size: 1em;
    transition: color var(--transition);
}
.footer-links ul li a:hover {
    color: var(--primary);
}
.footer-contact p {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.footer-contact p i {
    margin-right: 8px;
    color: var(--primary);
    font-size: 1em;
}
.main-footer .social-links {
    margin-top: 10px;
}
.main-footer .social-links a {
    color: var(--white);
    font-size: 1.2em;
    margin-right: 10px;
    background: none;
    border-radius: 0;
    box-shadow: none;
    transition: color var(--transition);
    padding: 0;
    width: auto;
    height: auto;
    display: inline-block;
}
.main-footer .social-links a:hover {
    color: var(--primary);
    background: none;
}
.copyright {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: #cccccc;
    font-size: 0.95em;
}

/* =====================
   UTILITY E GENERALI
   ===================== */
.card, .btn, .service-item, .portfolio-item, .milestone-item, .main-header, .main-footer, .sticky-comment-btn {
    transition: box-shadow var(--transition), transform var(--transition), background var(--transition), color var(--transition);
}
.section-fade {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(.4,0,.2,1), transform 0.8s cubic-bezier(.4,0,.2,1);
}
.section-fade.visible {
  opacity: 1;
  transform: none;
}
a:focus, button:focus, .btn:focus, input:focus, select:focus, textarea:focus {
    outline: revert;
    box-shadow: none;
    transition: none;
}
img:not([src]) {
    content: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23ccc"%3E%3Cpath d="M0 0h24v24H0V0z" fill="none"%3E%3C/path%3E%3Cpath d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.85 9.14L11.5 16l-3.35-4.5h-.01c-.13-.17-.3-.29-.5-.35-.45-.15-.92.05-1.16.4-.24.36-.12.82.26 1.05l3.5 4.75c.3.4.78.6 1.28.6h.01c.5 0 .98-.2 1.28-.6l4.25-5.75c.38-.5.25-1.07-.3-1.42-.5-.35-1.1-.2-1.45.3z"%3E%3C/path%3E%3C/svg%3E');
    width: 100%;
    height: auto;
    background-color: #f0f0f0;
    color: #888;
    display: block;
    text-align: center;
    line-height: 150px;
    font-size: 0.8em;
    font-style: italic;
}

/* =====================
   ANIMAZIONI
   ===================== */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* =====================
   MEDIA QUERIES
   ===================== */
@media (max-width: 992px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.1rem; }
    .main-nav {
        position: absolute;
        top: 90px;
        left: 0;
        width: 100%;
        background-color: var(--white);
        box-shadow: 0 5px 10px rgba(30,41,59,0.08);
        padding: 0;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.5s ease-in-out;
    }
    .main-nav.active {
        max-height: 500px;
    }
    .main-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        width: 100%;
        text-align: center;
    }
    .main-nav ul li {
        margin: 10px 0;
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.6s ease-in-out, transform 1.5s ease-in-out;
    }
    .main-nav.active ul li {
        opacity: 1;
        transform: translateY(0);
    }
    .main-nav.active ul li:nth-child(1) { transition-delay: 0.1s; }
    .main-nav.active ul li:nth-child(2) { transition-delay: 0.15s; }
    .main-nav.active ul li:nth-child(3) { transition-delay: 0.2s; }
    .main-nav.active ul li:nth-child(4) { transition-delay: 0.25s; }
    .main-nav.active ul li:nth-child(5) { transition-delay: 0.3s; }
    .main-nav.active ul li:nth-child(6) { transition-delay: 0.35s; }
    .main-nav .lang-btn {
        margin: 10px 0;
        opacity: 0;
        transform: translateY(-20px);
        transition: opacity 0.6s ease-in-out, transform 1.5s ease-in-out;
    }
    .main-nav.active .lang-btn {
        opacity: 1;
        transform: translateY(0);
        transition-delay: 0.4s;
    }
    .header-cta {
        display: none;
    }
    .menu-toggle {
        display: flex;
    }
    .hero-content {
        text-align: center;
    }
    .hero-content h1 {
        font-size: 2rem;
    }
    .about-content {
        flex-direction: column;
        text-align: center;
    }
    .about-text h2 {
        text-align: center;
    }
    .about-video {
        width: 100%;
        min-width: unset;
        flex: unset;
        padding-top: 56.25%;
   }
    .contact-grid {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        text-align: center;
    }
    .footer-about, .footer-links, .footer-contact, .footer-newsletter {
        margin-bottom: 20px;
    }
    .footer-about .social-links, .footer-contact p, .footer-links ul {
        justify-content: center;
    }
    .logo img {
        height: 60px;
    }
}
@media (max-width: 900px) {
    .container { padding: 0 12px; }
    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.1rem; }
}
@media (max-width: 600px) {
    .container { padding: 0 8px; }
    h1 { font-size: 1.1rem; }
    h2 { font-size: 1rem; }
    html, body, main, .container, section, .swiper, .swiper-wrapper, .swiper-slide {
      max-width: 100vw !important;
      overflow-x: hidden !important;
    }
    /* Eccezione per la sezione contatti */
    #contact,
    #contact .container,
    #contact .contact-grid,
    #contact .contact-location {
        overflow: visible !important;
        max-width: none !important;
    }
}

/* Sticky Back to Top Button - stile originale */
#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}
#back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}
#back-to-top button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 24px;
    cursor: pointer;
    transition: background 0.2s;
}
#back-to-top button:hover {
    background: var(--primary-light);
}

/* Pulsante cambio lingua navbar */
.lang-btn {
    background: transparent;
    border: 2px solid var(--primary, #d32f2f);
    color: var(--primary, #d32f2f);
    font-weight: 700;
    font-size: 1em;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    margin-left: 12px;
    outline: none;
}
.lang-btn:hover,
.lang-btn:focus {
    background: var(--primary, #d32f2f);
    color: #fff;
}
