/* --- 1. VARIABILI E BASE --- */
:root {
    --blue: #004F87;
    --text: #1d1d1f;
    --gray: #f5f5f7;
    --ink: #0A0A0A;
    --paper: #FAFAF8;
    --navy-deep: #071B2E;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Manrope', sans-serif;
    overflow-x: hidden;
    width: 100%;
    background: var(--paper);
}

body::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.02em; font-family: 'Bricolage Grotesque', 'Manrope', sans-serif; color: var(--ink); }
.display-serif { font-family: 'Fraunces', 'Bricolage Grotesque', serif; font-weight: 500; letter-spacing: -0.01em; line-height: 1.2; }
p, li { line-height: 1.7; color: #444; font-size: 1.05rem; margin-bottom: 15px; }
ul { padding-left: 20px; margin-bottom: 20px; }
li { margin-bottom: 8px; }

/* --- 2. NAVIGAZIONE (Trasparente -> Bianca) --- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 5%;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    z-index: 9999;
    transition: all 0.4s ease;
}

nav.scrolled {
    background: rgba(255, 255, 255, 0.98);
    padding: 15px 5%; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.logo-container { text-decoration: none; display: block; z-index: 1002; position: relative;}
.logo-img { height: 70px; width: auto; display: block; transition: height 0.3s ease; }
nav.scrolled .logo-img { height: 50px; }
.logo-container { display: flex; align-items: center; }
.logo-img-color { display: none; }
nav.scrolled .logo-img-white { display: none; }
nav.scrolled .logo-img-color { display: block; }

.nav-links { display: flex; align-items: center; }
.nav-links a {
    text-decoration: none;
    color: #ffffff;
    font-weight: 600;
    margin-left: 30px;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: color 0.3s;
}

nav.scrolled .nav-links a { color: var(--text); text-shadow: none; } 
nav.scrolled .nav-links a:hover { color: var(--blue); }

.hamburger { display: none; font-size: 1.8rem; cursor: pointer; color: #ffffff; text-shadow: 0 2px 10px rgba(0,0,0,0.5); background: none; border: none; padding: 0; font-family: inherit; line-height: 1; }
nav.scrolled .hamburger { color: var(--text); text-shadow: none; }

/* --- 3. LAYOUT PAGINE SINGOLE --- */
.page-header {
    background: linear-gradient(180deg, #eef2f5 0%, var(--paper) 100%);
    color: var(--ink);
    margin-top: 0;
    padding: 150px 10% 80px;
    text-align: center;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
    border-bottom: 1px solid #e5e5e0;
}
.page-header .eyebrow { justify-content: center; display: flex; }
.page-header h1 { font-size: 3.5rem; margin-bottom: 20px; color: var(--ink); }
.page-header p { color: #555; }
.page-content { max-width: 900px; margin: 0 auto; padding: 60px 20px; }

/* --- 4. HERO (Home) --- */
.hero { height: 100vh; width: 100%; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hero-bg { position: absolute; top: 0; left: 0; width: 100%; height: 120%; background-size: cover; background-position: center; z-index: 1; }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 2; }
.hero-text { position: relative; z-index: 3; color: white; text-align: center; max-width: 900px; padding: 20px; }
.hero h1 { color: #ffffff; font-size: clamp(2.8rem, 7vw, 5.5rem); line-height: 1.1; margin-bottom: 24px; text-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.hero-text p { color: #ffffff; font-size: 1.3rem; max-width: 640px; margin: 0 auto 30px; text-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.hero-cta { color: #ffffff !important; }
.hero-cta:hover { color: #ffffff !important; border-color: #ffffff !important; }

.statement-block { padding: 100px 10% 60px; max-width: 900px; margin: 0 auto; text-align: center; }
.statement-block p { font-size: clamp(1.6rem, 3.2vw, 2.6rem); line-height: 1.3; color: var(--ink); margin: 0; }
.statement-block p::first-letter { color: var(--blue); }

/* --- 5. SEZIONI E GRIGLIE --- */
.section { padding: 100px 10%; width: 100%; box-sizing: border-box; }
.bg-gray { background-color: var(--gray); width: 100vw; margin-left: calc(-50vw + 50%); }
.text-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 40px; }

.division-block { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: start; }
.division-block.reversed { direction: rtl; } 
.division-block.reversed .div-text { direction: ltr; }
.div-img-wrapper { width: 100%; height: 600px; border-radius: 20px; overflow: hidden; position: relative; }
.div-img { width: 100%; height: 130%; object-fit: cover; position: absolute; top: -15%; left: 0; }
.div-text h3 { font-size: 2.5rem; margin-bottom: 20px; border-left: 4px solid var(--blue); padding-left: 18px; margin-left: -22px; }

/* --- 6. BOTTONI --- */
.filter-btn {
    background: transparent; border: 2px solid var(--blue); color: var(--blue);
    padding: 10px 25px; border-radius: 25px; cursor: pointer; font-weight: 600;
    transition: all 0.3s ease; text-transform: uppercase; font-size: 0.9rem;
}
.filter-btn:hover, .filter-btn.active { background: var(--blue); color: white; }
.filter-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 15px; margin-top: 40px; margin-bottom: 20px; }

/* --- 7. COMPONENTI CARD (News e Progetti) --- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; max-width: 1200px; margin: 0 auto; }

.projects-editorial-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1400px;
    margin: 40px auto 0;
}
.projects-editorial-grid .project-card { min-width: unset; }
.projects-editorial-grid .project-card:first-child { grid-column: span 2; grid-row: span 2; display: flex; flex-direction: column; }
.projects-editorial-grid .project-card:first-child .p-img-box { flex: 1 1 auto; height: auto; min-height: 420px; }
.projects-editorial-grid .project-card:first-child .p-content { flex-shrink: 0; }

.projects-full-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px; margin-top: 40px; }
.projects-full-grid .project-card { min-width: unset; scroll-snap-align: unset; flex: unset; }

.project-card {
    background: white; border-radius: 8px; overflow: hidden; cursor: pointer;
    border: 1px solid #e5e5e0; box-shadow: none; transition: transform 0.3s, border-color 0.3s;
    min-width: 350px; flex: 0 0 auto; scroll-snap-align: start; animation: fadeIn 0.5s ease-out forwards;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; } }
.project-card:hover { transform: translateY(-6px); border-color: var(--blue); }

.p-img-box { height: 250px; position: relative; overflow: hidden; }
.p-img-box img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.project-card:hover .p-img-box img { transform: scale(1.1); }
.p-content { padding: 25px; }

.hover-reveal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,66,122,0.9); opacity: 0; display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; transition: opacity 0.3s;
}
.p-img-box:hover .hover-reveal { opacity: 1; }

.work-scroller-wrap { position: relative; }
.work-scroller {
    display: flex; gap: 24px; overflow-x: auto; overscroll-behavior-x: contain;
    /* spazio verticale perche la card ingrandita non venga tagliata dal contenitore */
    padding: 34px 0; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none; cursor: grab;
}
.work-scroller.is-dragging { cursor: grabbing; }
.work-scroller.is-dragging .work-card { pointer-events: none; }
.work-scroller::-webkit-scrollbar { display: none; }
.work-scroller-btn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper); border: 1px solid #e5e5e0; color: var(--ink);
    font-size: 1rem; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    transition: border-color 0.3s ease, color 0.3s ease;
}
.work-scroller-btn:hover { border-color: var(--blue); color: var(--blue); }
.work-scroller-btn.prev { left: -10px; }
.work-scroller-btn.next { right: -10px; }
.work-card { flex: 0 0 260px; cursor: pointer; transition: transform 0.35s cubic-bezier(.2,.7,.3,1); transform-origin: center center; }
.work-card:hover, .work-card:focus-visible { transform: scale(1.12); z-index: 2; }
.work-card-img { position: relative; width: 100%; height: 340px; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 20px rgba(7,27,46,0.10); }
.work-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.work-card:hover .work-card-img { box-shadow: 0 14px 40px rgba(7,27,46,0.22); }
.work-card-overlay {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 16px 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.35) 55%, transparent 100%);
}
.work-card-overlay h3 { color: #ffffff; font-size: 1.05rem; line-height: 1.25; margin: 0 0 5px; }
.work-card-overlay p { color: rgba(255,255,255,0.85); font-size: 0.78rem; line-height: 1.35; margin: 0; }
@media (max-width: 900px) {
    .work-card { flex: 0 0 230px; }
    .work-card:hover { transform: none; }
    .work-card-img { height: 300px; }
    .work-scroller-btn { display: none; }
}

/* --- 8. MODALE PROGETTI --- */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 99999; opacity: 0; visibility: hidden; transition: opacity 0.3s; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.modal.active { opacity: 1; visibility: visible; }
.modal-box { background: white; width: 100%; max-width: 900px; max-height: 90vh; border-radius: 15px; position: relative; display: flex; flex-direction: column; overflow: hidden; transform: scale(0.95); transition: transform 0.3s; }
.modal.active .modal-box { transform: scale(1); }
.m-header { width: 100%; height: 350px; flex-shrink: 0; position: relative; overflow: hidden; background: #000; }
.m-slides-wrapper { width: 100%; height: 100%; position: relative; }
.m-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s ease; }
.m-slide.active { opacity: 1; z-index: 2; }
.m-img-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: white; border: none; padding: 10px 15px; cursor: pointer; z-index: 10; font-size: 1.5rem; border-radius: 5px; transition: background 0.3s; }
.m-img-btn:hover { background: rgba(0,0,0,0.8); }
.m-img-btn.prev { left: 15px; }
.m-img-btn.next { right: 15px; }
.m-scroll-content { padding: 40px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.close-modal { position: absolute; top: 15px; right: 15px; width: 40px; height: 40px; background: white; border-radius: 50%; border: none; cursor: pointer; font-size: 24px; z-index: 100; box-shadow: 0 4px 10px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; }
.m-specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; background: #f4f4f4; padding: 25px; border-radius: 10px; margin-bottom: 30px; border: 1px solid #eee; }
.m-specs strong { display: block; color: var(--blue); font-size: 0.8rem; text-transform: uppercase; margin-bottom: 5px; }

/* --- 9. TEAM --- */
.team-container { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; }
.member { text-align: center; width: 240px; background: #ffffff; padding: 30px 20px; border-radius: 8px; border: 1px solid #e5e5e0; transition: transform 0.3s ease, border-color 0.3s ease; }
.member:hover { transform: translateY(-6px); border-color: var(--blue); }
.member img { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; border: 3px solid var(--blue); margin-bottom: 15px; filter: grayscale(1); transition: filter 0.4s ease; }
.member:hover img { filter: grayscale(0); }
.member h4 { margin-bottom: 5px; }
.member-bio { font-size: 0.82rem; line-height: 1.5; color: #666; margin: 14px 0 0 0; text-align: left; }
.member .member-bio + a, .member > a { margin-top: 14px; display: inline-block; }

/* --- 10. FOOTER (Aggiornato a 3 colonne responsive con mappa) --- */
.footer-sec { background: var(--navy-deep); color: #888; padding: 60px 10%; }
.footer-sec p, .footer-sec strong { color: #cccccc; }

.footer-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 50px; 
    align-items: start;
}

.form-box input, .form-box textarea { width: 100%; padding: 12px; margin-bottom: 10px; background: #222; border: 1px solid #333; color: white; border-radius: 6px; box-sizing: border-box;}
.hp-field { position: absolute !important; width: 1px !important; height: 1px; padding: 0 !important; border: 0 !important; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.submit-btn { background: var(--blue); color: white; border: none; padding: 12px 25px; border-radius: 25px; cursor: pointer; width: 100%; font-weight: bold; text-transform: uppercase;}

.footer-map-box { display: flex; flex-direction: column; }
.map-link { transition: color 0.2s ease-in-out; }
.map-link:hover { color: #ffffff !important; }

/* --- 11. MEDIA QUERIES (Mobile) --- */
@media(max-width: 900px) {
    .hamburger { display: block; z-index: 1003; }
    .nav-links { 
        position: fixed; 
        top: 0; left: 0; 
        width: 100%; height: 100vh; 
        background: #ffffff; 
        flex-direction: column; 
        justify-content: center; 
        padding: 0; 
        opacity: 0; visibility: hidden; 
        transition: 0.3s; z-index: 1001; 
    }
    .nav-links.active { opacity: 1; visibility: visible; }
    .nav-links a { 
        margin: 15px 0; 
        color: var(--text); 
        font-size: 1.2rem; 
        text-shadow: none; 
    }
    
    .division-block, .division-block.reversed, .footer-grid, .text-cols { grid-template-columns: 1fr; }
    .div-img-wrapper { height: 300px; position: relative; top: 0; margin-top: 30px;}
    .hero h1 { font-size: 3rem; }
    .projects-editorial-grid { grid-template-columns: 1fr; gap: 15px; }
    .projects-editorial-grid .project-card:first-child { grid-column: span 1; grid-row: span 1; }
    .projects-editorial-grid .project-card:first-child .p-img-box { min-height: 220px; }
    .news-grid .project-card { min-width: unset; width: 100%; }
    .p-img-box { height: 180px; } 
    
    .p-content { padding: 12px; }
    .p-content h4 { font-size: 0.95rem; line-height: 1.2; }
    .p-content p { font-size: 0.75rem; line-height: 1.4; }
}

/* --- HOVER E CLICK SU INTERA CARD NEWS --- */
.news-link-stretched {
    color: var(--blue); 
    font-weight: bold; 
    text-decoration: none; 
    font-size: 0.9rem; 
    margin-top: 15px; 
    display: block;
    transition: color 0.3s ease;
}

.news-link-stretched::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

.project-card:hover .news-link-stretched {
    color: #002d54;
}

.project-card:hover h4 {
    color: #002d54 !important;
}

/* --- 12. FASCIA STATISTICHE --- */
.stats-row { padding: 70px 10% 90px; width: 100vw; margin-left: calc(-50vw + 50%); box-sizing: border-box; background: var(--paper); border-bottom: 1px solid #e5e5e0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; max-width: 960px; margin: 0 auto; text-align: center; }
.stats-grid .stat-item:not(:last-child) { border-right: 1px solid #e5e5e0; }
/* Colonna flex: cosi le tre voci partono tutte dalla stessa quota, e numero e
   suffisso "+" restano affiancati sulla stessa riga di base anche a 375px. */
.stat-item { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.stat-value { display: flex; align-items: baseline; justify-content: center; white-space: nowrap; }
.stat-number, .stat-suffix { font-family: 'Bricolage Grotesque', 'Manrope', sans-serif; font-weight: 800; font-size: clamp(2.2rem, 4vw, 3.2rem); color: var(--blue); line-height: 1; letter-spacing: -0.02em; }
.stat-label { color: #777; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-top: 8px; }

@media(max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .stats-grid .stat-item:not(:last-child) { border-right: 1px solid #e5e5e0; }
    .stat-label { font-size: 0.68rem; letter-spacing: 0.04em; }
}

/* --- 13. EYEBROW LABEL E TEXT-LINK --- */
.eyebrow { display: block; color: var(--blue); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 12px; }
.eyebrow::after { content: ''; display: block; width: 34px; height: 2px; background: var(--blue); margin-top: 8px; }
.page-header .eyebrow::after, [style*="text-align:center"] > .eyebrow::after { margin-left: auto; margin-right: auto; }
.text-link { color: var(--ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; border-bottom: 2px solid transparent; padding-bottom: 4px; transition: border-color 0.3s ease, color 0.3s ease; }
.text-link:hover { border-color: var(--blue); color: var(--blue); }

/* --- 14. TIMELINE CHI SIAMO --- */
.timeline { position: relative; max-width: 800px; margin: 50px auto 0; padding-left: 40px; border-left: 2px solid #e5e5e0; }
.timeline-item { position: relative; padding-bottom: 50px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -46px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--blue); border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--blue); }
.timeline-year { display: block; color: var(--blue); font-family: 'Bricolage Grotesque', 'Manrope', sans-serif; font-weight: 800; font-size: 1.5rem; margin-bottom: 8px; }
.timeline-item h3 { margin-top: 0; margin-bottom: 15px; }