:root {
    --color-primary: #0a2351;    /* Blu istituzionale */
    --color-accent: #d32f2f;     /* Rosso */
    --color-cream: #f7f2e9;      /* Neutro caldo */
    --color-text: #1f1f1f;
    --color-muted: #5f6575;
    --color-light: #f4f6f8;
    --color-white: #ffffff;
    --shadow: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-soft: 0 4px 12px rgba(0,0,0,0.08);
    --container: 1100px;
    --header-height: 90px;
    
    /* Social Colors */
    --fb-color: #1877F2;
    --insta-color: #E4405F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Space Grotesk', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; line-height: 1.6; color: var(--color-text); background: radial-gradient(circle at 10% 20%, #f9fafc 0%, #f4f6f8 30%, #f7f2e9 100%); display: flex; flex-direction: column; min-height: 100vh; color-scheme: light; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

.container { width: 90%; max-width: var(--container); margin: 0 auto; }
.bg-light { background: var(--color-light); }
.section-padding { padding: 70px 0; }
.text-center { text-align: center; }
.btn { display: inline-block; padding: 12px 28px; background: var(--color-accent); color: white; border-radius: 50px; font-weight: 700; border:none; cursor: pointer; text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.5px; box-shadow: var(--shadow-soft); }
.btn:hover { background: #b71c1c; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:focus-visible { outline: 3px solid rgba(211,47,47,0.35); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); box-shadow: none; }
.btn.ghost:hover { background: rgba(10,35,81,0.08); color: var(--color-primary); }

/* Variante ghost su hero scuro */
.hero .btn.ghost { color: #fff; border-color: rgba(255,255,255,0.9); }
.hero .btn.ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* --- HEADER --- */
.site-header { background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; border-bottom: 4px solid var(--color-primary); height: var(--header-height); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 100%; }
.brand { display: flex; align-items: center; gap: 15px; height: 100%; overflow: hidden; }
.brand img { height: auto; width: auto; max-height: 70px; max-width: 250px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; justify-content: center; }
.brand h1 { font-size: 1.1rem; color: var(--color-primary); margin: 0; line-height: 1.2; font-weight: 800; }
.brand span { font-size: 0.85rem; color: #666; }

/* --- NAVIGAZIONE --- */
.main-nav ul { display: flex; gap: 25px; }
.main-nav a { font-weight: 600; color: var(--color-primary); text-transform: uppercase; font-size: 0.9rem; position: relative; }
.main-nav a:hover, .main-nav a.active { color: var(--color-accent); }
.main-nav a.active::after { content: ''; display: block; width: 100%; height: 2px; background: var(--color-accent); position: absolute; bottom: -5px; }
#mobile-menu-btn { display: none; font-size: 1.5rem; color: var(--color-primary); cursor: pointer; background: none; border: none; }

/* --- HERO --- */
.hero { background: linear-gradient(120deg, rgba(10,35,81,0.94), rgba(10,35,81,0.85) 50%, rgba(10,35,81,0.7)); color: white; padding: 80px 0; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: -40% 50% 0 -10%; background: radial-gradient(circle at 30% 30%, rgba(211,47,47,0.25), transparent 50%); opacity: 0.6; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; align-items: center; position: relative; z-index: 1; }
.hero-copy h1 { font-size: 2.8rem; margin-bottom: 15px; letter-spacing: -0.02em; }
.hero-copy p { font-size: 1.15rem; opacity: 0.9; margin-bottom: 28px; max-width: 640px; color: #e8edf6; }
.hero-ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-img-wrapper { max-width: 800px; margin: 0 auto; border-radius: 14px; overflow: hidden; box-shadow: 0 18px 35px rgba(0,0,0,0.35); border: 4px solid rgba(255,255,255,0.35); display: none; position: relative; }
.hero-img-wrapper img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- STATISTICHE (NUMERI) --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 30px; margin-top: 40px; }
.stat-card { background: white; padding: 28px; border-radius: 12px; text-align: center; border: 1px solid #e5e8ef; box-shadow: var(--shadow-soft); position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(10,35,81,0.06), rgba(211,47,47,0.06)); opacity: 0.9; }
.stat-card > * { position: relative; z-index: 1; }
.stat-number { font-size: 2.5rem; font-weight: 800; color: var(--color-primary); display: block; margin-bottom: 5px; }
.stat-label { font-size: 1rem; color: #666; text-transform: uppercase; letter-spacing: 1px; }

/* --- COSA FACCIAMO --- */
.what-we-do-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 26px; margin-top: 40px; }
.do-card { background: white; padding: 28px; border-radius: 14px; box-shadow: var(--shadow-soft); transition: transform 0.3s, box-shadow 0.3s; border: 1px solid #e8ebf2; }
.do-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.do-icon { font-size: 2.6rem; color: var(--color-accent); margin-bottom: 16px; display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; background: rgba(211,47,47,0.08); border-radius: 14px; }
.do-card h3 { font-size: 1.25rem; margin-bottom: 12px; color: var(--color-primary); letter-spacing: -0.01em; }

/* --- GALLERIA SLIDER --- */
.gallery-wrapper { position: relative; max-width: 100%; margin-top: 40px; padding: 0 10px; }
.gallery-track { display: flex; gap: 20px; overflow-x: auto; scroll-behavior: smooth; padding: 10px 5px; scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-item { flex: 0 0 320px; height: 220px; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-soft); position: relative; background: #0a2351; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s, opacity 0.3s; opacity: 0.95; }
.gallery-item:hover img { transform: scale(1.05); opacity: 1; }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.9); color: var(--color-primary); border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; box-shadow: 0 6px 12px rgba(0,0,0,0.18); z-index: 10; display: flex; align-items: center; justify-content: center; }
.slider-btn:hover { background: var(--color-accent); color: white; }
.prev-btn { left: 6px; }
.next-btn { right: 6px; }

/* --- PERCHE' ISCRIVERSI --- */
.why-join-section { background: linear-gradient(135deg, #0a2351, #0c2f6b); color: white; position: relative; overflow: hidden; }
.why-join-section::after { content: ""; position: absolute; inset: -20% 40% 0 -15%; background: radial-gradient(circle at 30% 30%, rgba(211,47,47,0.22), transparent 55%); opacity: 0.8; }
.why-join-content { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; z-index: 1; }
.why-list { display: inline-block; text-align: left; margin-bottom: 30px; padding: 0 8px; }
.why-list ul { margin-top: 20px; }
.why-list li { margin-bottom: 15px; display: flex; align-items: flex-start; gap: 15px; font-size: 1.1rem; padding-right: 10px; }
.why-list li i { color: var(--color-accent); margin-top: 5px; background: white; border-radius: 50%; padding: 5px; font-size: 0.8rem; width: 25px; height: 25px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.join-helper { margin-top: 10px; color: #d7deed; font-size: 0.95rem; }

/* --- CARDS GENERALI --- */
.highlights-grid, .news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; margin-top: 30px; }
.highlight-card { background: white; padding: 30px; border-radius: 8px; box-shadow: var(--shadow); text-align: center; border-top: 4px solid var(--color-accent); transition: transform 0.3s; }
.highlight-card:hover { transform: translateY(-5px); }
.highlight-icon { font-size: 2.5rem; color: var(--color-primary); margin-bottom: 20px; }
.news-card { background: #fff; padding: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); border-left: 4px solid var(--color-primary); }
.news-date { font-size: 0.8rem; color: #888; font-weight: bold; text-transform: uppercase; margin-bottom: 5px; }
.news-card h3 { font-size: 1.1rem; color: var(--color-primary); margin-bottom: 10px; }

/* --- VOLONTARI --- */
.vol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; margin-top: 30px; }
.vol-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-soft); border: 1px solid #eaeff2; display: flex; flex-direction: column; transition: transform 0.25s, box-shadow 0.25s; }
.vol-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.vol-img-container { height: 220px; background: repeating-linear-gradient(135deg, #e9edf4, #e9edf4 12px, #f6f8fb 12px, #f6f8fb 24px); display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #eee; position: relative; }
.vol-img-container img { width: 100%; height: 100%; object-fit: cover; }
.vol-placeholder { font-size: 3.4rem; color: #9aa3b5; }
.vol-info { padding: 20px; text-align: center; flex: 1; }
.vol-role { color: var(--color-accent); font-weight: bold; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; display: block; margin-bottom: 5px; }
.vol-info h3 { margin: 5px 0 10px; color: var(--color-primary); }

/* --- CONTACTS & MAPPA --- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: stretch; }
.info-box, .form-box { background: white; padding: 32px; border-radius: 12px; box-shadow: var(--shadow-soft); border: 1px solid #e8ebf2; }
.info-item { margin-bottom: 15px; display: flex; gap: 15px; font-size: 1rem; }
.info-item i { color: var(--color-accent); width: 20px; margin-top: 5px; }
.map-box { height: 100%; display: flex; flex-direction: column; background: white; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid #e0e5ef; }
.map-box iframe { width: 100%; flex-grow: 1; min-height: 400px; border: 0; }

/* Social Buttons */
.social-section { margin-top: 25px; padding-top: 25px; border-top: 1px solid #eee; }
.social-label { font-weight: bold; margin-bottom: 10px; display: block; color: var(--color-primary); }
.social-icons { display: flex; gap: 10px; }
.social-btn { display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; border-radius: 50%; color: white; font-size: 1.2rem; transition: transform 0.3s; text-decoration: none; }
.social-btn:hover { transform: translateY(-3px); opacity: 0.9; }
.btn-fb { background-color: var(--fb-color); }
.btn-insta { background-color: var(--insta-color); }

/* FAQ Accordion */
.faq-section { max-width: 800px; margin: 0 auto; }
.faq-item { margin-bottom: 15px; background: white; border-radius: 10px; box-shadow: var(--shadow-soft); overflow: hidden; border: 1px solid #e8ebf2; }
.faq-question { width: 100%; text-align: left; padding: 20px; background: white; border: none; font-size: 1.05rem; font-weight: 600; color: var(--color-primary); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.faq-question:hover { background: #f9f9f9; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; background: #fdfdfd; border-top: 1px solid transparent; }
.faq-item.active .faq-answer { border-top: 1px solid #eee; max-height: 1000px; }
.faq-content { padding: 20px; font-size: 0.95rem; color: #444; }
.faq-content ul { padding-left: 20px; list-style: disc; margin-top: 10px; }
.faq-content li { margin-bottom: 5px; }

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-control { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-family: inherit; }
.form-control:focus { border-color: var(--color-primary); outline: none; }
textarea.form-control { height: 120px; resize: vertical; }
.form-status { margin-top: 12px; font-size: 0.9rem; color: var(--color-primary); display: none; }

/* --- 5x1000 SECTION --- */
.five-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 3px dashed var(--color-accent); /* Bordo tratteggiato rosso */
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}
.fiscal-code-box {
    background: #f0f0f0;
    padding: 15px 25px;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--color-primary);
    display: inline-block;
    margin-top: 20px;
    border-radius: 6px;
    user-select: all; /* Permette di selezionare facilmente il codice */
    letter-spacing: 2px;
}

/* --- GALLERIA --- */
.gallery-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.gallery-page-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    height: 200px; /* Altezza fissa per uniformità */
}

.gallery-page-item:hover {
    transform: scale(1.03);
    z-index: 2;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.gallery-page-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Utility: trasporti */
.transport-icon { color: var(--color-accent); margin-right: 8px; }

/* FOOTER */
footer { background: var(--color-primary); color: rgba(255,255,255,0.7); padding: 25px; text-align: center; font-size: 0.9rem; margin-top: auto; }

/* MOBILE RESPONSIVE FIX */
@media (max-width: 768px) {
    :root { --header-height: auto; }
    .site-header { padding: 15px 0; }
    .header-inner { flex-direction: column; gap: 15px; height: auto; }
    #mobile-menu-btn { display: block; margin-top: 10px;}
    .main-nav { display: none; width: 100%; margin-top: 10px; }
    .main-nav.open { display: block; }
    .main-nav ul { flex-direction: column; gap: 0; text-align: center; padding-bottom: 15px; }
    .main-nav li { width: 100%; }
    .main-nav a { display: block; padding: 15px 0; border-bottom: 1px solid #f0f0f0; }
    
    .main-nav a.active::after { display: none; }
    .main-nav a.active { color: var(--color-accent); background-color: #fff5f5; border-left: 4px solid var(--color-accent); padding-left: 10px; }
    
    .contact-grid { grid-template-columns: 1fr; }
    .why-join-content { width: 100%; }
    .map-box iframe { min-height: 300px; }
    .hero h1 { font-size: 2rem; }
    .gallery-item { flex: 0 0 250px; height: 180px; }
    .slider-btn { display: none; }
    
    .fiscal-code-box { font-size: 1.4rem; padding: 10px 15px; }
}

/* DARK MODE AUTO */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #edf0f7;
        --color-muted: #c7ccda;
        --color-light: #0e1422;
        --color-cream: #0e1422;
        --shadow: 0 10px 30px rgba(0,0,0,0.55);
        --shadow-soft: 0 6px 16px rgba(0,0,0,0.45);
    }
    body { background: radial-gradient(circle at 25% 20%, #0d1424 0%, #0b1120 50%, #090e1a 100%); color-scheme: dark; }
    .site-header { background: #0b1220; border-bottom-color: rgba(255,255,255,0.08); box-shadow: 0 6px 18px rgba(0,0,0,0.45); }
    .brand h1 { color: #e6e8ef; }
    .brand span { color: #c2c7d6; }
    .main-nav a { color: #e6e8ef; }
    .main-nav a:hover, .main-nav a.active { color: var(--color-accent); }
    .main-nav a.active::after { background: var(--color-accent); }
    .hero { background: radial-gradient(circle at 20% 20%, rgba(211,47,47,0.15), transparent 40%), linear-gradient(150deg, #0c1930 0%, #0a152a 55%, #081222 100%); }
    .hero-copy h1 { color: #f7f8fb; }
    .hero-copy p { color: #d6dceb; }
    .hero-img-wrapper { border-color: rgba(255,255,255,0.25); box-shadow: 0 14px 32px rgba(0,0,0,0.45); background: #0b1220; }
    .section-padding.bg-light { background: #0e1422; }
    .stat-card, .do-card, .highlight-card, .news-card, .info-box, .form-box, .five-box, .vol-card, .gallery-page-item { background: #12192b; border-color: #1f293a; box-shadow: var(--shadow-soft); color: #edf0f7; }
    .stat-number { color: #f7f8fb; }
    .stat-label { color: #c7ccda; }
    .do-card h3, .vol-info h3 { color: #f7f8fb; }
    .do-card:hover, .vol-card:hover { box-shadow: var(--shadow); }
    .why-join-section { background: linear-gradient(150deg, #0b192d, #0a1c34); }
    .why-list li { color: #e6e8ef; }
    .contact-grid { color: #e6e8ef; }
    .map-box { background: #0f1828; border-color: #1f2b3f; box-shadow: var(--shadow); }
    .faq-item { background: #0f1828; border-color: #1f2b3f; }
    .faq-answer { background: #0f1828; }
    .gallery-item { background: #10182a; box-shadow: var(--shadow-soft); }
    .fiscal-code-box { background: #1a2435; color: #e6e8ef; }
    footer { background: #0b1220; color: rgba(230,232,239,0.78); }
    .btn.ghost { color: #fff; border-color: rgba(255,255,255,0.85); }
    .btn.ghost:hover { background: rgba(255,255,255,0.14); color: #fff; }
    .social-section { border-top-color: #1f2b3f; }
    .what-we-do-grid, .stats-grid, .vol-grid, .gallery-page-grid { color: #e6e8ef; }
    .faq-question { background: #12192b; color: #f5f7fd; }
    .faq-question:hover { background: #162236; }
    .faq-question:focus-visible { outline: 2px solid rgba(255,255,255,0.25); outline-offset: 2px; }
    .faq-item.active .faq-question { background: #162236; color: #f7f8fb; }
    .faq-item.active .faq-answer { background: #111a2b; }
    .faq-content { color: #e6e8ef; }
    .vol-img-container { background: repeating-linear-gradient(135deg, #1b2434, #1b2434 12px, #222c3e 12px, #222c3e 24px); }
    .vol-placeholder { color: #c5d4ee; }
    .vol-info, .vol-info p { color: #f2f4fb; }
    .info-box, .form-box { color: #f2f4fb; }
    .info-item strong { color: #f7f8fb; }
    .social-label { color: #f7f8fb; }
    h1, h2, h3, h4, h5, h6 { color: #f5f7fd; }
    .faq-section h2 { color: #f5f7fd !important; }
    .form-box h3, .form-box h4 { color: #f5f7fd !important; }
    .info-box h3 { color: #f5f7fd !important; }
    #privacy-text { color: #f2f4fb; }
    #about-sig { color: #f5f7fd !important; }
    .form-control { background: #0f1828; color: #f2f4fb; border-color: #2a3650; }
    .form-control::placeholder { color: #9aa3b5; }
    #contatti-page-title { color: #f5f7fd !important; }
    #details-title { color: #f5f7fd !important; }
    #privacy-title { color: #f5f7fd !important; }
    #faq-list { color: #f2f4fb; }
}
