/* --- RESET BASE & VARIABILI --- */
:root {
    --giallo-logo: #f3c400;
    --giallo-scuro: #d6a900;
    --bianco: #fffaf1;
    --grigio-scuro: #25211b;
    --grigio-chiaro: #f3eadb;
    --testo-corpo: #51483c;
    --carta-beige: #dec8a8;
    --carta-taupe: #706653;
    --ombra-calda: rgba(37, 33, 27, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Arial Black", "Arial Rounded MT Bold", Arial, Helvetica, sans-serif;
    scroll-behavior: smooth;
}

body {
    color: var(--testo-corpo);
    background: linear-gradient(180deg, #fffaf1 0%, #f3eadb 100%);
    line-height: 1.6;
}

p,
.section-subtitle,
.card-settore p,
.card-catalogo p,
.card-servizio p,
.footer-content p,
.form-group label,
.form-group input,
.form-group select,
.form-group textarea {
    font-family: Arial, Helvetica, sans-serif;
}

/* --- NAVBAR --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background: rgba(255, 250, 241, 0.94);
    border-bottom: 1px solid rgba(112, 102, 83, 0.22);
    box-shadow: 0 10px 30px var(--ombra-calda);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo .logo-dueffe,
.logo-dueffe {
    font-weight: 800;
    font-size: 24px;
    color: var(--giallo-logo);
    text-shadow: 2px 2px 0 var(--grigio-scuro), 0 4px 12px rgba(37, 33, 27, 0.22);
    border-bottom: 4px solid var(--grigio-scuro);
    letter-spacing: 1px;
}

.logo .logo-sub,
.logo-sub {
    font-size: 18px;
    color: var(--grigio-scuro);
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
}

.nav-links li {
    margin-left: 25px;
}

.nav-links a {
    text-decoration: none;
    color: var(--grigio-scuro);
    font-weight: 600;
    transition: color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

.nav-links a:hover {
    color: var(--giallo-scuro);
    transform: translateY(-1px);
}

.nav-links .btn-nav {
    background: linear-gradient(135deg, var(--giallo-logo), #ffd84a);
    padding: 8px 16px;
    border-radius: 4px;
    color: var(--grigio-scuro);
    box-shadow: 0 8px 20px rgba(214, 169, 0, 0.24);
    transition: all 0.3s ease;
}

.nav-links .btn-nav:hover {
    background: var(--grigio-scuro);
    color: var(--giallo-logo);
    transform: translateY(-2px);
}

.nav-phone .phone-link {
    font-size: 15px;
    font-weight: bold;
    color: var(--grigio-scuro);
    text-decoration: none;
    padding: 8px 14px;
    background: rgba(214, 169, 0, 0.15);
    border-radius: 4px;
    border: 1px solid var(--giallo-logo);
    transition: background-color 0.25s ease, color 0.25s ease;
    justify-content: margin-left;
}

/* --- HERO SECTION --- */
@font-face {
    font-family: 'Caroline';
    src: url('fonts/Caroline.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

#home {
    background: none;
    min-height: 100vh; 
    display: flex;
    align-items: center;
    justify-content: center;
}

#home.hero {
    position: relative;
    min-height: calc(100vh - 78px);
    background: linear-gradient(90deg, rgba(37, 33, 27, 0.88), rgba(112, 102, 83, 0.66));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 40px 20px;
}

.hero-bg {
    position: absolute;
    z-index: 0;
    inset: -8%;
    background: url('img1.png') no-repeat center top / cover;
    animation: heroBackgroundDrop 18s ease-in-out infinite alternate;
    will-change: background-position;
}

@keyframes heroBackgroundDrop {
    from { background-position: center top; }
    to { background-position: center bottom; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-bg { animation: none; }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    margin-top: auto;
    margin-bottom: auto;
    width: 100%;
    animation: dueffeHeroIn 0.75s ease both;
}

.hero-content h1 {
    font-family: 'Caroline', cursive, sans-serif;
    font-size: 8rem;
    color: var(--giallo-logo);
    text-shadow: 3px 3px 0 var(--grigio-scuro), 0 12px 28px rgba(0, 0, 0, 0.35);
    -webkit-text-stroke: 1px var(--grigio-scuro);
    transform: rotate(-5deg); 
    display: inline-block;
    font-weight: normal;
    margin: 0;
    padding: 10px;
}

.hero-content p {
    color: #f3c400;
} 

/* --- SEZIONE NUMERI / COUNTER --- */
.counters-section {
    display: flex;
    justify-content: space-around;
    background-color: var(--grigio-scuro);
    color: var(--bianco);
    padding: 40px 10%;
    text-align: center;
}

.counter-box .counter-number {
    font-size: 40px;
    font-weight: bold;
    color: var(--giallo-logo);
}

.counter-box .counter-plus {
    font-size: 30px;
    color: var(--giallo-logo);
}

.counter-box p {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
}

/* --- GRIGLIA LOGHI HOMEPAGE (FIX RISOLUTIVO 8 COLONNE x 2 RIGHE) --- */
.partners-section {
    max-width: 1400px;
    margin: 50px auto;
    padding: 0 20px;
}

.partners-title {
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: var(--grigio-scuro);
    text-align: center;
}

#logos-grid, 
.logos-grid {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr) !important; /* Forza 8 colonne precise */
    gap: 12px !important;
    width: 100% !important;
}

/* Stile per le card della Homepage generate da JS */
.index-logo-card {
    background-color: #ffffff !important; /* Sfondo bianco per tutti i loghi */
    border: 1px solid rgba(112, 102, 83, 0.2) !important;
    border-radius: 8px !important;
    height: 90px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 8px !important;
    box-shadow: 0 2px 8px rgba(37, 33, 27, 0.06) !important;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease !important;
}

.index-logo-card img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
}

.index-logo-card:hover {
    transform: translateY(-3px) !important;
    border-color: var(--giallo-logo) !important;
    box-shadow: 0 8px 18px rgba(37, 33, 27, 0.12) !important;
}

/* Stili per le schede nelle pagine di settore con hover */
.card-wrapper {
    width: 100%;
}

.sector-card {
    position: relative;
    display: block;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(112, 102, 83, 0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.sector-card-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.sector-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(37, 33, 27, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sector-card-logo {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
}

.sector-card:hover .sector-card-bg {
    transform: scale(1.08);
}

.sector-card:hover .sector-card-overlay {
    opacity: 1;
}

/* --- RESPONSIVE GRIGLIA LOGHI --- */
@media (max-width: 1100px) {
    #logos-grid, .logos-grid {
        grid-template-columns: repeat(4, 1fr) !important; /* 4 colonne su tablet */
    }
}

@media (max-width: 600px) {
    #logos-grid, .logos-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2 colonne su smartphone */
    }
}

/* --- STRUTTURA GENERALE SEZIONI --- */
.section-padding {
    padding: 80px 5%;
}

.bg-light {
    background-color: var(--grigio-chiaro);
}

.section-title {
    text-align: center;
    font-size: 32px;
    color: var(--grigio-scuro);
    margin-bottom: 15px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--giallo-logo);
    margin: 10px auto 0 auto;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 40px;
    color: #7F8C8D;
}

/* --- CARDS & GRIDS --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.card-settore,
.card-catalogo,
.card-catalogo-completa,
.categoria-blocco,
.modal-box {
    background: #ffffff;
    border: 1px solid rgba(112, 102, 83, 0.18);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 12px 30px rgba(37, 33, 27, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card-settore {
    text-align: center;
    border-top: 4px solid transparent;
}

.card-settore:hover,
.card-catalogo:hover,
.card-catalogo-completa:hover,
.card-servizio:hover {
    border-color: rgba(243, 196, 0, 0.55);
    box-shadow: 0 18px 38px rgba(37, 33, 27, 0.16);
    transform: translateY(-6px);
}

.card-settore:hover {
    border-top: 4px solid var(--giallo-logo);
}

.icon-sector {
    font-size: 45px;
    color: var(--grigio-scuro);
    margin-bottom: 20px;
}

.card-settore h3,
.card-catalogo h4,
.card-catalogo-completa h4,
.categoria-titolo {
    color: var(--grigio-scuro);
}

.card-servizio {
    background: var(--grigio-scuro);
    color: var(--bianco);
    padding: 30px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.card-servizio h3 {
    color: var(--giallo-logo);
    margin-bottom: 15px;
}

.card-servizio p {
    color: #BDC3C7;
    margin-bottom: 25px;
}

.btn-download,
.btn-submit-form {
    display: inline-block;
    padding: 10px 20px;
    background: var(--grigio-scuro);
    color: var(--bianco);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: transform 0.25s ease, background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.btn-download:hover,
.btn-submit-form:hover {
    background: var(--giallo-logo);
    color: var(--grigio-scuro);
    box-shadow: 0 10px 22px rgba(214, 169, 0, 0.25);
    transform: translateY(-2px);
}

.btn-scopri,
.link-esterno {
    display: inline-block;
    margin-top: 15px;
    color: var(--giallo-logo);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-scopri {
    color: var(--grigio-scuro);
    border-bottom: 2px solid var(--giallo-logo);
    padding-bottom: 2px;
}

.btn-scopri:hover {
    color: var(--giallo-scuro);
    border-bottom-color: var(--grigio-scuro);
    padding-left: 5px;
}

.hero-cta {
    display: inline-block;
    margin-top: 24px;
    padding: 13px 22px;
    border-radius: 4px;
    background: var(--giallo-logo);
    color: var(--grigio-scuro);
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

.hero-cta:hover { background: var(--bianco); }

.card-catalogo-link { color: inherit; text-decoration: none; }
.card-catalogo-link .btn-scopri { margin-top: 12px; }

.application-showcases { width: min(1200px, 100%); margin: 0 auto; display: grid; gap: 34px; }
.application-showcase { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 34px; align-items: center; padding: 24px; background: #fff; border: 1px solid rgba(112,102,83,.2); border-radius: 10px; box-shadow: 0 14px 30px rgba(37,33,27,.1); }
.application-showcase:nth-child(even) { grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); }
.application-showcase:nth-child(even) .application-gallery { order: 2; }
.application-showcase:nth-child(even) .application-copy { order: 1; }
.application-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.application-image-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
.application-gallery img { display: block; width: 100%; height: 180px; object-fit: cover; border-radius: 6px; }
.application-copy { padding: 8px 12px; }
.application-copy h3 { margin: 4px 0 12px; color: var(--grigio-scuro); font-size: 28px; }
.application-copy p:not(.section-kicker) { font-family: Arial, Helvetica, sans-serif; }
.application-copy .section-kicker { margin: 0; color: var(--giallo-scuro); }

/* Fasce applicative a tutta larghezza: immagini e testo respirano senza effetto card. */
.sector-content { padding-left: 0; padding-right: 0; }
.sector-content > .categoria-titolo { width: min(1200px, 90%); }
.application-showcases { width: 100%; gap: 0; }
.application-showcase,
.application-showcase:nth-child(even) { grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); min-height: 360px; padding: 42px 5%; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.application-showcase:nth-child(even) { background: rgba(255,255,255,.65); }
.application-showcase:nth-child(even) .application-gallery { order: 2; }
.application-showcase:nth-child(even) .application-copy { order: 1; }
.application-gallery { gap: 8px; height: 276px; }
.application-gallery img { height: 100%; border-radius: 0; }
.application-gallery img:first-child { border-radius: 10px 0 0 10px; }
.application-gallery img:last-child { border-radius: 0 10px 10px 0; }
.application-copy { max-width: 520px; padding: 24px clamp(18px, 4vw, 70px); }
.application-showcase:nth-child(odd) .application-copy { justify-self: start; }
.application-showcase:nth-child(even) .application-copy { justify-self: end; }

/* Composizione ispirata alla pagina di riferimento: testo libero a lato e fotografie grandi impilate. */
.application-showcase,
.application-showcase:nth-child(even) { grid-template-columns: minmax(280px, .82fr) minmax(0, 1.18fr); min-height: 0; padding: 72px 5%; background: #fff; }
.application-showcase:nth-child(even) { background: #faf9f6; }
.application-showcase .application-copy,
.application-showcase:nth-child(even) .application-copy { order: 1; justify-self: stretch; align-self: center; padding: 30px clamp(20px, 5vw, 100px) 30px 0; }
.application-showcase:nth-child(even) .application-copy { padding: 30px 0 30px clamp(20px, 5vw, 100px); }
.application-showcase .application-gallery,
.application-showcase:nth-child(even) .application-gallery { order: 2; display: grid; grid-template-columns: 1fr; grid-auto-rows: minmax(180px, 1fr); height: auto; max-height: 680px; gap: 18px; }
.application-showcase:nth-child(even) .application-gallery { order: 1; }
.application-gallery img,
.application-gallery img:first-child,
.application-gallery img:last-child { height: 100%; min-height: 180px; border-radius: 0; object-fit: cover; }
.application-showcase .open-popup-btn { display: none; }

.sector-contact-cta { padding: 78px 20px 86px; text-align: center; background: var(--grigio-scuro); color: var(--bianco); }
.sector-contact-cta p { margin-bottom: 22px; font-size: clamp(20px, 3vw, 30px); }
.sector-contact-cta a { display: inline-block; padding: 13px 24px; border-radius: 4px; background: var(--giallo-logo); color: var(--grigio-scuro); font-weight: 800; text-decoration: none; }

/* Slider orizzontale: tre immagini affiancate, proporzioni integre e movimento continuo. */
.application-showcase,
.application-showcase:nth-child(even) { display: block; padding: 58px 5% 64px; }
.application-showcase .application-gallery,
.application-showcase:nth-child(even) .application-gallery { display: block; width: 100%; height: auto; max-height: none; overflow: hidden; order: initial; }
.application-gallery-track { display: flex; width: 200%; gap: 18px; animation: applicationGalleryMove 22s linear infinite; will-change: transform; }
.application-gallery-track .application-image-link { flex: 0 0 calc((100% - 90px) / 6); width: calc((100% - 90px) / 6); }
.application-gallery-track img,
.application-gallery-track img:first-child,
.application-gallery-track img:last-child { flex: 0 0 calc((100% - 90px) / 6); width: calc((100% - 90px) / 6); height: auto; min-height: 0; aspect-ratio: 4 / 3; object-fit: contain; background: #f1eee7; border-radius: 8px; }
.application-gallery-track .application-image-link img { width: 100%; }
.application-showcase .application-copy,
.application-showcase:nth-child(even) .application-copy { max-width: 900px; margin: 30px auto 0; padding: 0 10px; text-align: center; order: initial; }
.application-copy .section-kicker { margin-bottom: 6px; }
.application-copy h3 { margin-top: 0; }
@keyframes applicationGalleryMove { from { transform: translateX(0); } to { transform: translateX(calc(-50% - 9px)); } }

@media (prefers-reduced-motion: reduce) {
    .application-gallery-track { animation: none; }
}

/* --- SEZIONE CATALOGHI & LOGHI BRAND --- */
.categoria-blocco {
    margin-bottom: 60px;
}

.categoria-titolo {
    font-size: 22px;
    border-left: 5px solid var(--giallo-logo);
    padding-left: 15px;
    margin-bottom: 20px;
}

.logo-azienda-wrapper {
    background: #ffffff;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #EDF2F7;
}

.logo-azienda-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* --- PROFILE DUEFFE --- */
.dueffe-profile {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 28px;
    align-items: center;
    max-width: 1000px;
    margin: 56px auto 0 auto;
    padding: 24px;
    background: linear-gradient(135deg, #fffaf1, var(--carta-beige));
    border: 1px solid rgba(112, 102, 83, 0.28);
    border-left: 8px solid var(--giallo-logo);
    border-radius: 8px;
    box-shadow: 0 18px 40px rgba(37, 33, 27, 0.16);
}

.dueffe-profile__photo {
    position: relative;
    display: block;
    min-height: 230px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--grigio-scuro);
    box-shadow: inset 0 0 0 4px var(--giallo-logo);
    cursor: pointer;
    text-decoration: none;
}

.dueffe-profile__photo img {
    width: 100%;
    height: 100%;
    min-height: 230px;
    object-fit: cover;
    object-position: center 28%;
    filter: saturate(1.05) contrast(1.04);
    transition: transform 0.6s ease, filter 0.6s ease;
}

.dueffe-profile:hover .dueffe-profile__photo img {
    transform: scale(1.04);
    filter: saturate(1.15) contrast(1.08);
}

.dueffe-profile__photo:focus-visible {
    outline: 3px solid var(--giallo-logo);
    outline-offset: 4px;
}

.dueffe-profile__eyebrow {
    color: var(--carta-taupe);
    font-size: 13px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.dueffe-profile h3 {
    color: var(--grigio-scuro);
    font-size: 30px;
    line-height: 1.1;
    margin-bottom: 12px;
}

.dueffe-profile p {
    color: var(--testo-corpo);
    margin-bottom: 18px;
}

.dueffe-profile__contact {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dueffe-profile__contact span {
    padding: 8px 12px;
    border-radius: 4px;
    background: rgba(37, 33, 27, 0.08);
    color: var(--grigio-scuro);
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 700;
}

/* --- MODAL POP-UP --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    border-top: 6px solid var(--giallo-logo);
    width: 100%;
    max-width: 500px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--grigio-scuro);
}

.close-popup-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #94A3B8;
    transition: color 0.2s;
}

.close-popup-btn:hover {
    color: #E74C3C;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--grigio-scuro);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--giallo-scuro);
}

/* --- FOOTER --- */
footer {
    background-color: var(--grigio-scuro);
    color: #BDC3C7;
    padding: 40px 5% 10px 5%;
    margin-top: 80px;
}

.footer-content {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    margin: 0 auto 30px;
    text-align: left;
}

.footer-column {
    min-width: 0;
}

.footer-column h4 {
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid var(--giallo-logo);
    color: var(--bianco);
}

.footer-column a {
    color: inherit;
}

.footer-column i,
.social-links a {
    color: var(--giallo-logo);
}

.logo-sub {
    color: var(--giallo-logo);
}

.social-links {
    display: flex;
    gap: 15px;
    font-size: 22px;
}

.social-links a {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(243, 196, 0, 0.45);
    border-radius: 50%;
    text-decoration: none;
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.social-links a:hover {
    color: var(--grigio-scuro);
    background: var(--giallo-logo);
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-column h4 {
        display: inline-block;
    }

    .social-links {
        justify-content: center;
    }
}
    margin-bottom: 30px;
}

.footer-content p {
    margin-bottom: 8px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #34495E;
    padding-top: 20px;
    font-size: 13px;
}

/* --- ANIMAZIONI UTILITY --- */
.dueffe-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}

.dueffe-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

/* --- RESPONSIVE GENERALE --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 15px;
    }
    .nav-links {
        margin-top: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-links li {
        margin: 5px 10px;
    }
    .hero-content h1 {
        font-size: 4rem;
    }
    .counters-section {
        flex-direction: column;
        gap: 20px;
    }
    .dueffe-profile {
        grid-template-columns: 1fr;
        padding: 18px;
    }
    .dueffe-profile h3 {
        font-size: 24px;
    }
    .story-layout {
        grid-template-columns: 1fr;
        gap: 26px;
    }
    .story-layout .story-copy {
        text-align: center;
    }
    .dueffe-map {
        padding: 8px 0 0;
    }
}


/* --- CORREZIONE SPECIFICA PER PAGINE SETTORE --- */
/* --- CORREZIONE SPECIFICA PER PAGINE SETTORE --- */

/* Ripristina il contenitore per i settori senza forzare altezze rigide */
.card-wrapper {
    width: 100%;
    margin-bottom: 25px;
}

.sector-card-name {
    margin: 14px 0 4px;
    color: var(--grigio-scuro);
    font-size: 18px;
}

.sector-card-description {
    margin: 0;
    color: var(--testo-corpo);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

/* Stile della card settore con immagine di copertina + logo overlay */
.sector-card {
    position: relative;
    display: block;
    width: 100%;
    height: 180px !important; /* Altezza adeguata per contenere la copertina */
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(112, 102, 83, 0.2);
    box-shadow: 0 4px 12px rgba(37, 33, 27, 0.08);
    text-decoration: none;
}

.sector-card-bg {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.4s ease;
}

.sector-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(37, 33, 27, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sector-card-logo {
    max-width: 80% !important;
    max-height: 80% !important;
    object-fit: contain !important;
}

.sector-card:hover .sector-card-bg {
    transform: scale(1.08);
}

.sector-card:hover .sector-card-overlay {
    opacity: 1;
}

/* Adatta la griglia nelle pagine di settore */
body:not(:has(#home)) #logos-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 20px !important;
    margin-bottom: 50px !important;
    height: auto !important;
}

/* Margine di sicurezza per i titoli successivi */
.categoria-titolo, 
h2, h3 {
    clear: both;
    margin-top: 40px;
}

/* --- AGGIORNAMENTO NAVIGAZIONE E PAGINE SETTORE --- */
/* Le regole e le transizioni del blocco hero originale sono lasciate invariate. */
.site-page {
    background-color: #f7f4ec;
    background-image: linear-gradient(120deg, rgba(243, 196, 0, 0.07), transparent 34%, rgba(75, 103, 96, 0.08) 72%, transparent);
    background-size: 180% 180%;
    animation: pageSurfaceShift 18s ease-in-out infinite alternate;
}

.navbar {
    display: block;
    padding: 0;
}

.site-nav {
    width: min(1440px, 100%);
    min-height: 78px;
    margin: 0 auto;
    padding: 10px 5%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand-cluster {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.phone-link {
    color: var(--grigio-scuro);
    text-decoration: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 2px solid var(--giallo-logo);
    padding: 6px 0;
}

.brand-logo {
    display: grid;
    width: 50px;
    height: 50px;
    overflow: hidden;
    border: 2px solid var(--giallo-logo);
    border-radius: 50%;
    background: var(--grigio-scuro);
    place-items: center;
    box-shadow: 0 4px 12px rgba(37, 33, 27, 0.16);
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-nav .nav-links {
    gap: 22px;
    margin: 0;
    justify-content: flex-end;
}

.site-nav .nav-links li {
    margin: 0;
}

.site-nav .btn-nav {
    white-space: nowrap;
}

.hero-brand {
    color: var(--giallo-logo);
    font-size: clamp(4.5rem, 10vw, 10.5rem);
    font-weight: 800;
    line-height: 0.84;
    letter-spacing: 1px;
    text-shadow: 3px 3px 0 var(--grigio-scuro), 0 12px 28px rgba(0, 0, 0, 0.35);
    margin: 0 0 18px;
}

.hero-brand span {
    display: block;
    color: #fff4dc;
    font-size: 0.36em;
    letter-spacing: 2px;
    margin-top: 14px;
}

.hero-content h1 {
    font-family: 'Caroline', 'Brush Script MT', 'Segoe Script', cursive;
    font-size: clamp(2.2rem, 5.2vw, 5.5rem);
    font-weight: normal;
    line-height: 1.05;
    color: #fff4dc;
    text-shadow: 0 5px 18px rgba(0, 0, 0, 0.4);
    -webkit-text-stroke: 0;
    transform: none;
    padding: 0;
    width: 70%;
    max-width: 70%;
    margin: 0 auto;
    letter-spacing: 0.025em;
}

.section-heading {
    text-align: center;
    margin-bottom: 42px;
    
}

.section-kicker {
    color: var(--carta-taupe);
    font-family: 'Caroline';
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.section-surface {
    position: relative;
    background-color: rgba(255, 255, 255, 0.72);
    background-image: linear-gradient(135deg, rgba(243, 196, 0, 0.08), transparent 40%, rgba(83, 120, 111, 0.07));
    background-size: 150% 150%;
    animation: surfaceShift 14s ease-in-out infinite alternate;
}

.sector-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.image-row {
    padding: 0 5% 72px;
}

.image-row__slot {
    width: min(1200px, 100%);
    height: 180px;
    margin: 0 auto;
    border: 2px dashed rgba(112, 102, 83, 0.44);
    background: rgba(255, 250, 241, 0.48);
}

.story-copy {
    max-width: 820px;
    margin: 0 auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    text-align: center;
}

.story-copy p + p {
    margin-top: 18px;
}

.story-layout {
    width: min(1100px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 42px;
    align-items: center;
}

.story-layout .story-copy {
    max-width: none;
    margin: 0;
    text-align: left;
}

.story-image {
    margin: 0;
    overflow: visible;
}

.story-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.dueffe-map {
    width: 100vw;
    margin: 38px 0 0 calc(50% - 50vw);
    padding: 8px 0 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.dueffe-map__header h3 {
    margin: 0 0 8px;
    color: var(--grigio-scuro);
    font-size: 26px;
}

.dueffe-map__header p:last-child {
    margin: 0 0 18px;
    font-family: Arial, Helvetica, sans-serif;
}

.dueffe-map__header i {
    color: var(--giallo-scuro);
    margin-right: 6px;
}

.dueffe-map__header {
    padding: 0 5vw;
}

.dueffe-map__frame {
    overflow: hidden;
    min-height: 320px;
    border-radius: 0;
    background: transparent;
}

.dueffe-map__frame iframe {
    display: block;
    width: 100%;
    height: clamp(420px, 20vh, 680px);
    border: 0;
}

.story-section {
    padding-bottom: 0;
}

.story-section + footer {
    margin-top: 0;
}

.sector-page .navbar {
    position: relative;
}

.sector-hero {
    min-height: calc(100vh - 78px);
    display: grid;
    place-items: center;
    padding: 92px 5%;
    text-align: center;
    color: var(--bianco);
    background-color: var(--grigio-scuro);
    background-image: linear-gradient(125deg, rgba(37, 33, 27, 0.95), rgba(37, 33, 27, 0.78) 48%, rgba(78, 109, 99, 0.72));
    background-size: 160% 160%;
    animation: sectorSurfaceShift 16s ease-in-out infinite alternate;
}

/* Immagine hero per settore: sostituisci il percorso tra apici quando avrai le foto definitive. */
.sector-termoidraulica .sector-hero { background-image: linear-gradient(125deg, rgba(37, 33, 27, 0.86), rgba(37, 33, 27, 0.62)), url('imges/opere/termi.jpg'); }
.sector-edilizia .sector-hero { background-image: linear-gradient(125deg, rgba(37, 33, 27, 0.86), rgba(37, 33, 27, 0.62)), url('imges/opere/pvcc.jpg'); }
.sector-irrigazione .sector-hero { background-image: linear-gradient(125deg, rgba(37, 33, 27, 0.86), rgba(37, 33, 27, 0.62)), url('imges/opere/toroag1.jpg'); }
.sector-infrastrutture .sector-hero { background-image: linear-gradient(125deg, rgba(37, 33, 27, 0.86), rgba(37, 33, 27, 0.62)), url('imges/opere/bancale.jpg'); }

.sector-hero > div {
    width: min(900px, 100%);
}

.sector-hero .section-kicker {
    color: var(--giallo-logo);
}

.sector-hero h1 {
    color: var(--bianco);
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 1;
    margin: 0;
}

.sector-hero h1::after {
    content: "";
    display: block;
    width: 78px;
    height: 4px;
    margin: 24px auto;
    background: var(--giallo-logo);
}

.sector-hero p:last-child {
    max-width: 680px;
    margin: 0 auto;
    color: #fff4dc;
    font-size: 19px;
}

.sector-intro {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
    font-size: 19px;
}

.home-page .sector-intro {
    width: 100%;
    max-width: none;
    margin: 0;
    background-image: linear-gradient(90deg, rgba(5, 43, 63, 0.74), rgba(5, 83, 116, 0.58)), url('imges/lavori/water-20.gif');
    background-size: cover;
    background-position: center;
}

.home-page .sector-intro .section-kicker {
    max-width: 1000px;
    margin: 0 auto;
    display: block;
    padding: 0;
    font-size: clamp(20px, 2.2vw, 27px);
    line-height: 1.3;
    color: #fffaf1;
    text-shadow: 0 2px 10px rgba(0, 24, 37, 0.42);
}

.sector-page .sector-intro > p {
    max-width: 1000px;
    margin: 0 auto;
    display: block;
    padding: 0;
    font-family: 'Caroline';
    font-size: clamp(17px, calc(2.2vw - 3px), 24px);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--grigio-scuro);
    background: none;
    text-shadow: 0 2px 8px rgba(37, 33, 27, 0.18);
}



@media (max-width: 600px) {
    .home-page .sector-intro .section-kicker {
        font-size: 20px;
    }

    .sector-page .sector-intro > p {
        font-size: 17px;
    }
}

.sector-content {
    margin-top: 38px;
}

.sector-content .categoria-titolo {
    width: min(1200px, 100%);
    margin: 0 auto 24px;
}

.sector-content .categoria-titolo + .gallery-grid {
    margin-bottom: 72px;
}

.gallery-grid {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.gallery-item {
    min-width: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(112, 102, 83, 0.2);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(37, 33, 27, 0.1);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.gallery-item:hover {
    transform: translateY(-7px);
    box-shadow: 0 20px 36px rgba(37, 33, 27, 0.17);
}

.gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item h3 {
    min-height: 62px;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 16px 18px;
    color: var(--grigio-scuro);
    font-size: 17px;
}

.card-settore,
.card-catalogo,
.gallery-item,
.sector-card {
    animation: cardEnter 0.65s ease both;
}

.card-settore:nth-child(2), .card-catalogo:nth-child(2), .gallery-item:nth-child(2) { animation-delay: 0.08s; }
.card-settore:nth-child(3), .card-catalogo:nth-child(3), .gallery-item:nth-child(3) { animation-delay: 0.16s; }
.card-settore:nth-child(4) { animation-delay: 0.24s; }

@keyframes pageSurfaceShift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@keyframes surfaceShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes sectorSurfaceShift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
@keyframes cardEnter { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1000px) {
    .sector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .site-nav { flex-wrap: wrap; }
}

@media (max-width: 768px) {
    .site-nav { justify-content: center; gap: 12px; padding: 10px 16px; }
    .site-nav .nav-links { width: 100%; justify-content: center; gap: 10px 16px; }
    .site-nav .nav-links li { margin: 0; }
    .site-nav .nav-links a { font-size: 13px; }
    .site-nav .btn-nav { padding: 7px 10px; }
    .brand-logo { width: 44px; height: 44px; }
    .hero-content h1 { font-size: 1.25rem; }
    .sector-hero, #home.hero { min-height: calc(100vh - 126px); }
    .gallery-grid, .sector-grid { grid-template-columns: 1fr; }
    .image-row__slot { height: 128px; }
    .application-showcase, .application-showcase:nth-child(even) { padding: 42px 5%; }
    .application-showcase:nth-child(even) .application-gallery, .application-showcase:nth-child(even) .application-copy { order: initial; }
    .application-showcase .application-copy, .application-showcase:nth-child(even) .application-copy { padding: 18px 0 30px; }
    .application-gallery img { height: 160px; min-height: 160px; }
    .application-copy h3 { font-size: 23px; }

    .hero-content h1 {
        width: 85%;
        max-width: 85%;
        font-size: clamp(2rem, 9vw, 3.4rem);
    }
}
