/* Nascondi intro tapparella su mobile */
@media (max-width: 768px) {
    .flip-card-front {
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 2rem 1.5rem !important;
        min-height: auto !important;
        position: static !important;
        background: white !important;
        border-radius: 20px !important;
        box-shadow: var(--shadow) !important;
    }
    .flip-card-front h3 {
        font-size: 1.4rem !important;
        margin-bottom: 1rem !important;
        font-weight: 600 !important;
        color: var(--cedimet-green) !important;
        line-height: 1.3 !important;
    }
    .flip-card-front p {
        font-size: 1rem !important;
        margin: 0 !important;
        color: var(--text-light) !important;
        line-height: 1.6 !important;
        display: block !important;
        font-weight: normal !important;
    }
    .service-icon {
        font-size: 3.5rem !important;
        margin-bottom: 1.5rem !important;
        display: block !important;
    }
    .flip-card {
        perspective: none !important;
        cursor: default !important;
    }
    .flip-card-inner {
        transform: none !important;
        transition: none !important;
    }
    .flip-card.flipped .flip-card-inner {
        transform: none !important;
    }
    .flip-card-back {
        display: none !important;
    }
    .flip-card-front {
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 2.2rem 0 2.2rem 0 !important;
        min-height: 120px;
    }
    .flip-card-front h3 {
        font-size: 1.35rem !important;
        margin: 0.7rem 0 0 0 !important;
        font-weight: 700;
        color: var(--cedimet-green);
        letter-spacing: 0.01em;
        line-height: 1.2;
        text-shadow: 0 1px 0 #fff, 0 2px 8px #eee;
    }
    .service-icon {
        font-size: 2.5rem !important;
        margin-bottom: 0.4rem !important;
    }
    .stat .number {
        background: linear-gradient(90deg,
            #6c757d 0%,
            #868e96 20%,
            #adb5bd 35%,
            #f8f9fa 50%,
            #adb5bd 65%,
            #868e96 80%,
            #6c757d 100%
        ) !important;
        -webkit-background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        background-clip: text !important;
        background-size: 300% 100% !important;
        background-position: 0% 50% !important;
        animation: metal-reflection 4s ease-in-out infinite !important;
        text-shadow: 1px 1px 0 rgba(255,255,255,0.2), 0 1px 0 rgba(0,0,0,0.3) !important;
        filter: contrast(1.3) brightness(1.1) !important;
    }
    #tapparella-intro {
        display: none !important;
    }
}
/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Variabili CSS */
:root {
    --cedimet-green: #2d5016;
    --cedimet-green-light: #4a7c2a;
    --cedimet-silver: #b8b8b8;
    --cedimet-dark-silver: #8a8a8a;
    --cedimet-metallic-silver: #c0c5ce; /* Base grigio metalizzato più chiaro */
    --cedimet-white: #ffffff;
    --cedimet-black: #2c2c2c;
    --accent-gold: #d4af37;
    --text-light: #666;
    --border-light: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Header e Navbar */
.header {
    background: var(--cedimet-white);
    box-shadow: var(--shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    height: 50px;
    width: auto;
    border-radius: 8px;
}

.logo-text h1 {
    color: var(--cedimet-green);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.logo-text span {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 400;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    text-decoration: none;
    color: var(--cedimet-black);
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover {
    color: var(--cedimet-green);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--cedimet-green);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.hamburger {
    /* display: none; */
    flex-direction: column;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--cedimet-green);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--cedimet-green) 0%, var(--cedimet-green-light) 100%);
    color: white;
    padding: 120px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.hero-logo {
    margin-bottom: 2rem;
}

.hero-logo-img {
    height: 80px;
    width: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    color: var(--cedimet-green);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 1rem;
    margin-top: -100px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    padding: 1.5rem;
    background: var(--cedimet-green);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid var(--cedimet-silver);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    min-width: 150px;
    color: white;
}

.stat .number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, 
        #6c757d 0%,     /* Base scura */
        #868e96 20%,    /* Grigio medio-scuro */
        #adb5bd 35%,    /* Grigio medio */
        #f8f9fa 50%,    /* Riflesso centrale */
        #adb5bd 65%,    /* Grigio medio */
        #868e96 80%,    /* Grigio medio-scuro */
        #6c757d 100%    /* Base scura */
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 300% 100%;
    background-position: 0% 50%;
    animation: metal-reflection 4s ease-in-out infinite;
    margin-bottom: 0.5rem;
    text-shadow: 
        1px 1px 0 rgba(255, 255, 255, 0.2),
        0 1px 0 rgba(0, 0, 0, 0.3);
    filter: contrast(1.3) brightness(1.1);
}

.stat .label {
    font-size: 0.9rem;
    opacity: 0; /* Inizia invisibile */
    transition: opacity 0.8s ease;
    text-transform: uppercase; /* Forza maiuscolo */
    letter-spacing: 1px; /* Spaziatura per effetto industriale */
}

/* Semplice comparsa */
.letter-scroll.visible {
    opacity: 0.9;
}

/* Rimuovo tutti gli stili precedenti */
.letter-scroll {
    font-family: inherit;
    color: inherit;
}

.letter-scroll.scrolling {
    color: inherit;
}

.cta-button {
    display: inline-block;
    background: var(--cedimet-white); /* Cambiato da accent-gold a bianco */
    color: var(--cedimet-black);
    padding: 1rem 2.5rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: heartbeat-light 3s ease-in-out infinite; /* Heartbeat più leggero */
}

.cta-button:hover {
    background: #f0f0f0; /* Hover per pulsante bianco */
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Pulsante verde per "Richiedi Preventivo" con effetto heartbeat */
.cta-button-green {
    background: var(--cedimet-white) !important; /* Sfondo bianco */
    color: var(--cedimet-green) !important; /* Scritta verde CEDIMET */
    border: 2px solid var(--cedimet-green); /* Bordo verde per definire meglio il pulsante */
    animation: heartbeat 2s ease-in-out infinite; /* Effetto battito cardiaco */
}

.cta-button-green:hover {
    background: var(--cedimet-white) !important; /* Mantiene sfondo bianco anche al hover */
    color: var(--cedimet-green) !important; /* Mantiene scritta verde */
    border-color: var(--cedimet-green-light) !important; /* Bordo verde più chiaro al hover */
    animation: heartbeat-hover 1.5s ease-in-out infinite; /* Battito più veloce al hover */
    box-shadow: 0 6px 20px rgba(45, 80, 22, 0.3) !important; /* Ombra verde più intensa */
}

.cta-button-outline {
    display: inline-block;
    background: transparent;
    color: white;
    padding: 1rem 2.5rem;
    text-decoration: none;
    border: 2px solid white;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    animation: heartbeat-outline 3.5s ease-in-out infinite; /* Heartbeat per pulsante outline */
}

.cta-button-outline:hover {
    background: white;
    color: var(--cedimet-green);
}

/* About Section */
.about-section {
    padding: 80px 0;
    background: #f8f9fa;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.about-text h2 {
    color: var(--cedimet-green);
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.lead {
    font-size: 1.2rem;
    color: var(--cedimet-green);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.about-features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.feature-item strong {
    color: var(--cedimet-green);
    font-size: 1.1rem;
    display: block;
    margin-bottom: 0.5rem;
}

.feature-item p {
    margin: 0;
    color: var(--text-light);
}

.about-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, var(--cedimet-green), var(--cedimet-green-light));
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-hover);
}

.image-placeholder small {
    font-size: 1rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Services Section */
.services-preview {
    padding: 80px 0;
    background: white;
}

.services-preview h2 {
    text-align: center;
    color: var(--cedimet-green);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.2rem;
    margin-bottom: 4rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.service-card {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--cedimet-green), var(--cedimet-green-light));
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.service-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1.5rem;
}

.service-card h3 {
    color: var(--cedimet-green);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.service-card p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.service-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-features li {
    color: var(--text-light);
    margin-bottom: 0.8rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-features li:before {
    content: '✓';
    color: var(--cedimet-green);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Why Choose Us Section */
.why-choose-us {
    padding: 80px 0;
    background: #f8f9fa;
}

.why-choose-us h2 {
    text-align: center;
    color: var(--cedimet-green);
    font-size: 2.5rem;
    margin-bottom: 4rem;
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.feature:hover {
    transform: translateY(-5px);
}

.feature .feature-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    display: block;
}

.feature h3 {
    color: var(--cedimet-green);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.feature p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--cedimet-green) 0%, var(--cedimet-green-light) 100%);
    color: white;
    text-align: center;
}

.cta-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.cta-content p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
#footer {
    background: var(--cedimet-black);
    color: white;
    padding: 60px 0 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.footer-section h5 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
    font-weight: 600;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.footer-logo-img {
    height: 40px;
    width: auto;
    border-radius: 50%;
    background: white;
    padding: 4px;
}

.footer-logo h3 {
    color: #fff;
    font-size: 1.5rem;
    margin: 0;
    font-weight: 700;
}

.footer-logo span {
    color: var(--cedimet-silver);
    font-size: 0.9rem;
}

.footer-section p {
    color: var(--cedimet-silver);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul li a {
    color: var(--cedimet-silver);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: var(--accent-gold);
}

.contact-info p {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.contact-info a {
    color: var(--cedimet-silver);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: var(--accent-gold);
}

.business-hours p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 2rem;
    text-align: center;
    color: var(--cedimet-silver);
}

.footer-bottom p {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.footer-bottom a {
    color: var(--cedimet-silver);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-bottom a:hover {
    color: var(--accent-gold);
}

/* Modal Styles */
#contact-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    padding: 2rem;
    border-radius: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--cedimet-dark-silver);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--cedimet-green);
    color: white;
}

.modal-content h3 {
    color: var(--cedimet-green);
    margin-bottom: 2rem;
    font-size: 1.8rem;
    font-weight: 700;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-content input,
.modal-content textarea {
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.modal-content input:focus,
.modal-content textarea:focus {
    outline: none;
    border-color: var(--cedimet-green);
}

.modal-content textarea {
    min-height: 120px;
    resize: vertical;
}

.modal-content button[type="submit"] {
    background: var(--cedimet-green);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-content button[type="submit"]:hover {
    background: var(--cedimet-green-light);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 80, 22, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: white;
        flex-direction: column;
        box-shadow: var(--shadow);
        padding: 1rem 0;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        text-align: center;
        padding: 0.5rem 0;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
        flex-direction: column;
        align-items: center;
        margin-top: 2.5rem !important; /* abbassa le stats su mobile */
    }
    
    .stat {
        min-width: 200px;
    }
    
    .about-text h2,
    .services-preview h2,
    .why-choose-us h2,
    .cta-content h2 {
        font-size: 2rem;
    }
    
    .services-grid {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
    }
    .service-card {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 2rem !important;
        word-break: break-word;
        box-sizing: border-box;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .hero {
        padding: 100px 0 60px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .service-card,
    .feature {
        padding: 2rem;
    }
    
    .about-section,
    .services-preview,
    .why-choose-us,
    .cta-section {
        padding: 60px 0;
    }
}

/* Animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-card,
.feature-item,
.feature {
    animation: fadeInUp 0.6s ease-out;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus states per accessibilità */
button:focus,
input:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--cedimet-green);
    outline-offset: 2px;
}

/* Fix spaziatura logo header */
.logo-text h1 {
    color: var(--cedimet-green);
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    margin-bottom: -0.5 rem;
    line-height: 1.2;
}

.logo-text h2 {
    color: var(--cedimet-green);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
    margin-bottom: 0.2rem;
    line-height: 1.1;
}

.logo-text span {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1;
}

/* Animazione Tapparella Orientabile (desktop only) */
@media (min-width: 769px) {
    #tapparella-intro {
        position: fixed;
        inset: 0;
        z-index: 2000;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent; /* Sfondo trasparente invece di bianco */
        pointer-events: none;
        animation: tapparella-fadeout 0.3s ease 2.8s forwards; /* Fade più veloce e prima */
    }

    .tapparella-orientabile {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .lamelle-container {
        position: absolute;
        inset: 0;
        display: flex;
        justify-content: center;
        align-items: stretch;
    }

    .lamella {
        width: 5%; /* Larghezza fissa per controllo migliore */
        background: linear-gradient(180deg,
            var(--cedimet-green) 0%,
            var(--cedimet-green-light) 30%,
            var(--cedimet-green) 70%,
            var(--cedimet-green-light) 100%);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        border-right: 1px solid rgba(0, 0, 0, 0.2);
        box-shadow: 
            inset 2px 0 4px rgba(255, 255, 255, 0.1),
            inset -2px 0 4px rgba(0, 0, 0, 0.2),
            2px 0 6px rgba(0, 0, 0, 0.1);
        position: relative;
        transform-origin: center center;
        transform: rotateY(0deg);
        animation: lamella-open 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) var(--delay) forwards;
    }

    .lamella::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        bottom: 0;
        width: 2px;
        background: linear-gradient(180deg,
            transparent 0%,
            rgba(255, 255, 255, 0.4) 20%,
            rgba(255, 255, 255, 0.6) 50%,
            rgba(255, 255, 255, 0.4) 80%,
            transparent 100%);
        transform: translateX(-50%);
    }

    .lamella::after {
        content: '';
        position: absolute;
        top: 0;
        left: 20%;
        right: 20%;
        bottom: 0;
        background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%);
    }

    /* Branding libero e indipendente */
    .branding-libero {
        position: absolute;
        left: 50%;
        top: 48%; /* Posizionato ancora più in alto */
        transform: translate(-50%, -50%);
        z-index: 1500; /* Sotto le lamelle ma sopra il sito */
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 0.8rem; /* Gap ridotto per avvicinare i testi */
        animation: branding-fadeout 0.8s ease-out 1.0s forwards; /* Scompare ancora prima per sincronizzazione perfetta */
    }

    .logo-circle {
        width: 140px; /* Ridotto da 160px per migliore proporzione */
        height: 140px; /* Ridotto da 160px per migliore proporzione */
        background: var(--cedimet-white);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
        border: 4px solid rgba(255, 255, 255, 0.95);
        margin-bottom: 0.5rem; /* Margine ridotto */
    }

    .intro-logo {
        height: 140px; /* Stesso size del cerchio per riempimento completo */
        width: auto;
        border-radius: 12px;
    }

    .intro-title {
        color: var(--cedimet-white);
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Stesso font della navbar */
        font-size: 3rem;
        font-weight: 700;
        margin: 0;
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
        letter-spacing: 4px;
        line-height: 1; /* Line-height ridotto */
    }

    .intro-subtitle {
        color: var(--cedimet-white);
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Stesso font della navbar */
        font-size: 1.2rem;
        font-weight: 500;
        margin: 0;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
        letter-spacing: 3px;
        opacity: 0.95;
        line-height: 1; /* Line-height ridotto */
    }

    /* Heartbeat leggero per pulsante "Chiamaci ora" */
    @keyframes heartbeat-light {
        0% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        20% {
            transform: scale(1.03);
            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
        }
        40% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        60% {
            transform: scale(1.03);
            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
        }
        80% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
    }

    /* Heartbeat per pulsante outline "Scrivici" */
    @keyframes heartbeat-outline {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
        }
        15% {
            transform: scale(1.04);
            box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1);
        }
        30% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        }
        45% {
            transform: scale(1.04);
            box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.1);
        }
        70% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
        }
    }

    /* Animazione heartbeat per pulsante */
    @keyframes heartbeat {
        0% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        14% {
            transform: scale(1.05);
            box-shadow: 0 6px 12px rgba(45, 80, 22, 0.2);
        }
        28% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        42% {
            transform: scale(1.05);
            box-shadow: 0 6px 12px rgba(45, 80, 22, 0.2);
        }
        70% {
            transform: scale(1);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
    }

    @keyframes heartbeat-hover {
        0% {
            transform: scale(1) translateY(-3px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }
        20% {
            transform: scale(1.08) translateY(-3px);
            box-shadow: 0 10px 30px rgba(45, 80, 22, 0.3);
        }
        40% {
            transform: scale(1) translateY(-3px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }
        60% {
            transform: scale(1.08) translateY(-3px);
            box-shadow: 0 10px 30px rgba(45, 80, 22, 0.3);
        }
        80% {
            transform: scale(1) translateY(-3px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        }
    }

    /* Rimuovo animazioni Matrix/Letter precedenti */
    @keyframes matrix-glow {
        0% {
            text-shadow: 0 0 5px rgba(45, 80, 22, 0.6);
            color: var(--cedimet-green);
        }
        100% {
            text-shadow: 0 0 10px rgba(45, 80, 22, 0.9);
            color: #4a7c2a;
        }
    }

    /* Rimuovo animazioni non necessarie */
    @keyframes matrix-glow {
        0% {
            text-shadow: 0 0 5px rgba(45, 80, 22, 0.8);
            color: var(--cedimet-green);
        }
        100% {
            text-shadow: 0 0 15px rgba(45, 80, 22, 1);
            color: #4a7c2a;
        }
    }

    /* Rimuovo animazione scanner */
    @keyframes scanner-sweep {
        0% {
            left: -100%;
        }
        50% {
            left: 0%;
        }
        100% {
            left: 100%;
        }
    }

    /* Rimuovo animazioni typewriter */
    @keyframes blink-cursor {
        0%, 50% {
            border-right-color: var(--cedimet-white);
        }
        51%, 100% {
            border-right-color: transparent;
        }
    }

    /* Rimuovo animazione label precedente */
    @keyframes label-appear {
        0% {
            opacity: 0;
            transform: translateY(10px);
        }
        100% {
            opacity: 0.9;
            transform: translateY(0);
        }
    }

    /* Animazione riflesso metallico sottile */
    @keyframes metal-reflection {
        0% {
            background-position: -50% 50%;
        }
        50% {
            background-position: 150% 50%;
        }
        100% {
            background-position: -50% 50%;
        }
    }

    /* Animazioni keyframes */
    @keyframes lamella-open {
        0% {
            transform: rotateY(0deg);
            opacity: 1;
        }
        100% {
            transform: rotateY(90deg);
            opacity: 0;
        }
    }

    @keyframes branding-fadeout {
        0% {
            opacity: 1;
            transform: translate(-50%, -50%) rotateY(0deg);
        }
        100% {
            opacity: 0;
            transform: translate(-50%, -50%) rotateY(90deg);
        }
    }

    @keyframes tapparella-fadeout {
        0% { 
            opacity: 1; 
            visibility: visible; 
        }
        100% { 
            opacity: 0; 
            visibility: hidden; 
        }
    }
}

/* Accessibility: rispetta le preferenze di movimento ridotto */
@media (prefers-reduced-motion: reduce) {
    #tapparella-intro,
    .intro-logo,
    .intro-title,
    .intro-subtitle,
    .lamella,
    .branding-libero {
        animation: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}
