:root {
    --primary-color: #2563eb;
    --text-color: #1f2937;
    --bg-color: #f8da16; /*#f9fafb;*/
    --card-bg: #ffffff;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Sezione Intro/Header */
.intro {
    text-align: center;
    padding: 10px 10px;
    /*background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    */
    margin-bottom: 20px;
}
.intro img {
    padding: 2px;
    margin-bottom: 0;
}

#intro-thread {
    margin-top: 10px;
    border: none;
    height: 2px; 
    background-color: #9d001b;
}

.logo {
    max-width: 150px;
    height: auto;
    margin-bottom: 20px;
}

h1 { margin-bottom: 2px; color: #111827; }
.intro p { max-width: 600px; margin: 0 auto; color: #4b5563; }

/* Griglia Eventi */
.eventi-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
}

@media (min-width: 768px) {
    .eventi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .cms-content {
        padding-left: 0;          /* remove any left padding that could hide part of the image */
        padding-right: 0;         /* same for the right side – keeps it symmetrical */
        margin-left: 0;
        margin-right: 0;
        
        /* Ensure the wrapper can grow to the full viewport width */
        width: 100%;
        max-width: 100%;

        /* If some other rule forced overflow‑hidden, turn it off */
        overflow-x: visible;   /* or simply omit overflow altogether */
    }
    
    .cms-content img {
        display: block;            /* eliminates the inline‑element whitespace on the right */
        width: 100%;               /* forces the image to take the full width of its container */
        max-width: 100%;           /* never exceed the container */
        height: auto;              /* keep the original aspect ratio */
        box-sizing: border-box;    /* makes any future padding/border count inside the width */
    }
}

/* Card Evento */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
}

.card-img-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Forzo il formato quadrato 1:1 */
}

.card-img-container img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.meta-info {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 10px;
}

.luogo {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 10px;
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #111827;
}

.descrizione {
    color: #4b5563;
    margin-bottom: 20px;
    flex-grow: 1;
}

/* Pulsanti e Link */
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    text-align: center;
    transition: background 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}
.btn-primary:hover { background-color: #1d4ed8; }

.btn-secondary {
    background-color: #3b5998; /* Colore Facebook */
    color: white;
}
.btn-secondary:hover { background-color: #2d4373; }

.no-events {
    text-align: center;
    grid-column: 1 / -1;
    padding: 40px;
    color: #6b7280;
}

/* Stile del Footer */
footer {
    text-align: center;
    margin-top: 60px;       /* Spazio sopra il footer per non appiccicarlo agli eventi */
    padding: 30px 20px;     /* Spazio interno */
    border-top: 1px solid #e5e7eb; /* Una linea sottile e chiara per separarlo dal resto */
    font-size: 0.85rem;     /* Testo leggermente più piccolo del normale */
    color: #6b7280;         /* Un grigio discreto ma leggibile */
}

/* Stile del link all'interno del footer */
footer a {
    color: var(--primary-color); /* Usa il blu definito nelle variabili in alto */
    text-decoration: none;       /* Rimuove la sottolineatura di default */
    font-weight: 600;            /* Rende il link leggermente più evidente */
    transition: color 0.2s ease;
}

/* Effetto al passaggio del mouse sul link */
footer a:hover {
    color: #1d4ed8;              /* Il blu diventa un po' più scuro */
    text-decoration: underline;  /* Appare la sottolineatura per far capire che è cliccabile */
}

/* Stile specifico per le card in stato di Bozza */
.card-bozza {
    border: 2px dashed #f59e0b !important; /* Bordo tratteggiato arancione */
    position: relative; /* Serve per posizionare il badge all'interno */
}

.badge-bozza {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: #f59e0b;
    color: white;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Make the image scale down on small screens */
.cms-content img {
    max-width: 100%;      /* never wider than its container */
    height: auto;         /* keep the aspect‑ratio */
    display: block;       /* removes the tiny bottom gap caused by inline‑img */
}

/* Add a little breathing room around the picture */
.cms-content p > img {
    margin: 1rem auto;    /* vertical space; auto centers it if the container is narrower */
}

/* Optional: tweak for phones (≤ 600 px wide) */
@media (max-width: 600px) {
    .cms-content img {
        max-width: 100vw;     /* use the full viewport width if the container is wider */
        border-radius: 4px;   /* a subtle rounded‑corner look on mobile */
    }
}
