:root {
    --primary-red: #e63946;
    --text-dark: #2d2d2d;
    --text-muted: #666;
    --bg-light: #fdfaf6;
    --white: #ffffff;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto;
}

/* Header & Brand */
.main-header {
    background: var(--white);
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.brand-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.brand-red { color: var(--primary-red); }
.brand-main { color: var(--text-dark); }
.brand-white { color: white; }

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
}

.main-nav a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.main-nav a:hover { color: var(--primary-red); }

/* Hero Section */
.hero {
    padding: 120px 0;
    text-align: center;
    background: linear-gradient(rgba(253, 250, 246, 0.8), rgba(253, 250, 246, 0.8)), 
                url('https://www.panecoraggioso.com/assets/img/photo-splash.jpeg'); /* Immagine di farina soft */
    background-size: cover;
    background-position: center;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

/* Sezione Prodotti - FIX GRIGLIA */
.section-title {
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    margin: 60px 0 40px;
}

.product-grid {
    display: grid;
    /* auto-fill invece di auto-fit impedisce all'elemento singolo di allargarsi troppo */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); 
    gap: 30px;
    margin-bottom: 80px;
}

.product-card {
    background: var(--white);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.product-card:hover { transform: translateY(-10px); }

.product-image-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: #eee;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Mantiene le proporzioni senza deformare */
}

.product-info {
    padding: 25px;
}

.product-info h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin: 0 0 10px 0;
    color: var(--text-dark);
}

.product-info p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.ingredients {
    font-size: 0.8rem;
    display: block;
    padding-top: 15px;
    border-top: 1px solid #eee;
    color: #888;
}

/* Footer */
.main-footer {
    background: #1a1a1a;
    color: #fff;
    padding: 60px 0;
    text-align: center;
}
/* Modal per Galleria */
.modal-custom {
    display: none; 
    position: fixed; 
    z-index: 9999; 
    left: 0; top: 0; 
    width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    justify-content: center; align-items: center;
    padding: 20px;
}

.modal-content-custom {
    background: #fff;
    display: flex;
    flex-direction: row;
    max-width: 900px;
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.modal-img { width: 50%; max-height: 500px; object-fit: cover; }
.modal-body { width: 50%; padding: 40px; }
.modal-close { position: absolute; top: 15px; right: 20px; font-size: 2.5rem; cursor: pointer; color: #333; line-height: 1; }

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content-custom { flex-direction: column; max-height: 90vh; overflow-y: auto; }
    .modal-img, .modal-body { width: 100%; }
    .modal-img { height: 200px; }
    
}
/* Forza il contenitore social ad avere una dimensione fissa ma responsive */
.fb-container {
    width: 100%;
    max-width: 500px; /* La larghezza massima che desideri */
    margin: 0 auto;
    min-height: 600px; /* Evita che il contenitore collassi a 0px */
    overflow: hidden;
}

/* Fix per forzare l'iframe di Facebook a prendersi lo spazio */
.fb-page, .fb-page span, .fb-page iframe[style] {
    width: 100% !important;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
/* Nascondiamo il placeholder quando l'SDK di Facebook è pronto */
.fb_iframe_widget iframe {
    background: white !important;
}
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
html {
    scroll-behavior: smooth; /* Rende fluidi tutti gli ancoraggi del menu */
}

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-red);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: none; /* Nascosto di default */
    justify-content: center;
    align-items: center;
    text-decoration: none;
    z-index: 1000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    font-size: 1.5rem;
}
.menu-toggle {
    display: none; /* Nascosto su desktop */
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: var(--text-dark);
    transition: all 0.3s ease;
}
@media (max-width: 768px) {
    .menu-toggle {
        display: flex; /* Visibile su mobile */
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%; /* Nascosto a destra */
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--white);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.4s ease;
        z-index: 1000;
        padding-top: 80px; /* Spazio per non sovrapporsi al logo */
    }

    .main-nav.active {
        right: 0; /* Appare scorrendo */
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .main-nav a {
        font-size: 1.2rem;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Animazione Hamburger -> X */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
        background-color: var(--primary-red);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
        background-color: var(--primary-red);
    }

    /* Overlay scuro quando il menu è aperto */
    .menu-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .menu-overlay.active { display: block; }
}
/* Regola d'oro per immagini responsive */
img {
    max-width: 100%;
    height: auto;
    display: block; /* Toglie lo spazio bianco sotto le immagini */
}