/*
Theme Name: GeneratePress Child - Massalengo News
Template: generatepress
Version: 1.0.0
*/

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700;900&family=Open+Sans:wght@400;600;700&display=swap');

:root {
    --primary: #C41E3A;
    --secondary: #1E3A8A;
    --dark: #222;
    --gray: #666;
    --light-bg: #f8f8f8;
    --border: #ddd;
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--dark);
    background: #fff;
}

h1, h2, h3 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--dark);
}

a {
    color: var(--dark);
    text-decoration: none;
}

a:hover {
    color: var(--primary);
}

/* HEADER */
.site-header {
    background: #fff;
    border-bottom: 3px solid var(--primary);
    position: sticky;
    top: 0;
    z-index: 999;
}

.main-title a {
    display: block;
    line-height: 0;
}

/* LOGO HEADER */
.header-logo {
    max-height: 70px;
    width: auto;
    display: block;
}

.main-navigation a {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.8rem 1rem;
}

/* MAIN SPONSOR */
.main-sponsor-header {
    max-width: 1000px;
    height: auto;
    margin: 1.5rem auto;
    text-align: center;
}

.main-sponsor-header img {
    max-width: 100%;
    height: auto;
}

/* LAYOUT MAGAZINE - SIDEBAR PIÙ LARGA */
.magazine-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 3rem;
}

.main-column {
    width: 100%;
}

/* HERO POST */
.hero-post {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid var(--border);
}

.hero-image {
    margin-bottom: 1.5rem;
}

.hero-image img {
    width: 100%;
    height: 450px;
    object-fit: cover;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin: 1rem 0 0.5rem;
    line-height: 1.2;
}

.hero-excerpt {
    font-size: 1.1rem;
    color: var(--gray);
    margin: 1rem 0;
    line-height: 1.7;
}

.cat-label {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-label-small {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.25rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.post-meta {
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.5rem;
}

/* GRIGLIA ARTICOLI */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.post-card {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.post-thumb {
    display: block;
    margin-bottom: 0.8rem;
}

.post-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card h2 {
    font-size: 1.1rem;
    margin: 0.5rem 0;
    line-height: 1.4;
}

/* SIDEBAR - LARGHEZZA FISSA 360PX */
.sidebar {
    width: 360px;
}

.sidebar .widget {
    background: var(--light-bg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    width: 360px;
}

.sidebar .widget-title {
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

/* BANNER SIDEBAR - NO DEFORMAZIONE */
.widget_text img {
    width: 336px;
    height: 280px;
    display: block;
    margin-bottom: 1.5rem;
}

/* SINGLE POST */
.single-post .entry-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.entry-subtitle {
    font-size: 1.3rem;
    color: var(--secondary);
    font-weight: 400;
    margin-bottom: 1rem;
}

.category-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.single-post .entry-content {
    font-size: 18px;
    line-height: 1.8;
}

.single-post .entry-content img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
}

/* ARTICOLI CORRELATI */
.related-posts {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 3px solid var(--border);
}

.related-posts h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.related-card {
    border: 1px solid var(--border);
}

.related-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.related-card-content {
    padding: 1rem;
}

.related-card h4 {
    font-size: 1rem;
    margin: 0;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .magazine-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .sidebar .widget {
        width: 100%;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-logo {
        max-height: 45px;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }
}

/* SEZIONI HOME */
.section-title {
    font-family: 'Merriweather', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

/* PRIMO PIANO - 2 ARTICOLI GRANDI */
.primo-piano-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.primo-piano-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.featured-article {
    background: #fff;
}

.featured-thumb img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    margin-bottom: 1rem;
}

.featured-content h2 {
    font-size: 1.8rem;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.featured-content p {
    color: var(--gray);
    margin: 0.8rem 0;
}

/* SEZIONI CATEGORIE - 3 ARTICOLI */
.category-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

/* Banner inline: nascosti su desktop, visibili solo su mobile */
.mobile-inline-banners {
    display: none;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.category-article {
    background: #fff;
}

.category-thumb img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    margin-bottom: 0.8rem;
}

.category-article h3 {
    font-size: 1.2rem;
    margin: 0.5rem 0;
    line-height: 1.4;
}

/* RESPONSIVE SEZIONI */
@media (max-width: 1024px) {
    .primo-piano-grid,
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .primo-piano-grid,
    .category-grid {
        grid-template-columns: 1fr;
    }
}

/* HERO PRIMO PIANO - 1 ARTICOLO GRANDE */
.primo-piano-section {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 3px solid var(--border);
}

.hero-primo-piano {
    display: block;
}

.hero-primo-thumb img {
    width: 100%;
    height: 500px;
    object-fit: cover;
    margin-bottom: 1.5rem;
}

.hero-primo-content h1 {
    font-size: 2.8rem;
    margin: 1rem 0 0.8rem;
    line-height: 1.2;
}

.hero-primo-content p {
    font-size: 1.2rem;
    color: var(--gray);
    margin: 1rem 0;
    line-height: 1.7;
}

/* FOOTER CUSTOM */
.custom-footer {
    background: #2D2D2D;
    color: #ccc;
    padding: 3rem 0 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #444;
}

.footer-col h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-family: 'Merriweather', serif;
}

.footer-col p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.footer-col a {
    color: #ccc;
    text-decoration: none;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding: 2rem 0;
    text-align: center;
    font-size: 0.85rem;
}

.footer-bottom p {
    margin: 0.3rem 0;
}

.footer-bottom a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* Nascondi il footer GeneratePress originale */
.site-info {
    display: none;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* FOOTER CUSTOM CHIARO */
.site-footer,
.site-info {
    display: none !important;
}

.custom-footer {
    background: #f5f5f5;
    border-top: 3px solid var(--primary);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #ddd;
}

/* LOGO FOOTER */
.footer-logo {
    max-height: 85px;
    width: auto;
    display: block;
    margin-bottom: 1rem;
}

.footer-col h3 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-family: 'Merriweather', serif;
    font-weight: 700;
}

.footer-col p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.8;
    margin: 0;
}

.footer-note {
    font-size: 0.75em;
    font-style: italic;
    color: #888;
    margin-top: 0.8rem !important;
    line-height: 1.5;
}

.footer-note a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-note a:hover {
    text-decoration: underline;
}

.footer-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-nav li {
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.footer-nav a {
    color: #555;
    font-size: 0.95rem;
    text-decoration: none;
}

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

.footer-bottom {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0.3rem 0;
}

.footer-bottom a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

.footer-legal {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* BANNER SIDEBAR - 10 SLOT */
.ads-wrapper img {
    width: 336px;
    height: 280px;
    display: block;
    margin: 0 0 1.5rem 0;
}

.ads-wrapper a {
    display: block;
    margin-bottom: 1.5rem;
}

.ads-wrapper a img {
    margin-bottom: 0;
}

/* LAYOUT ARTICOLO SINGOLO */
.single-article-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 3rem;
}

.single-content {
    width: 100%;
}

.single-sidebar {
    width: 360px;
}

.single-sidebar .widget {
    background: var(--light-bg);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.single-sidebar .widget-title {
    font-family: 'Merriweather', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

@media (max-width: 1024px) {
    .single-article-container {
        grid-template-columns: 1fr;
    }
    
    .single-sidebar {
        width: 100%;
        max-width: 360px;
        margin: 0 auto;
    }
}

/* WIDGET ARTICOLI RECENTI PIÙ PICCOLO */
.sidebar .wp-block-heading,
.sidebar .widget-title {
    font-size: 1rem !important;
    font-weight: 700;
}

.sidebar .wp-block-latest-posts li a,
.sidebar .widget ul li a {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
}

.sidebar .wp-block-latest-posts li,
.sidebar .widget ul li {
    margin-bottom: 0.8rem;
}

/* TITOLO ARTICOLI RECENTI ROSSO */
.sidebar .wp-block-heading {
    color: var(--primary) !important;
}

/* TITOLI CATEGORIE ROSSI NELLE PAGINE ARCHIVIO */
.archive .page-title,
.archive .entry-title,
.category .page-title,
.category .entry-title {
    color: var(--primary) !important;
}

.archive h1,
.category h1 {
    color: var(--primary) !important;
}

/* LAYOUT ARCHIVIO CATEGORIE */
.archive-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 3rem;
}

.archive-content {
    width: 100%;
}

.archive-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

.archive-title {
    font-size: 2.5rem;
    color: var(--primary) !important;
    margin-bottom: 0.5rem;
}

.archive-description {
    color: var(--gray);
    font-size: 1.1rem;
}

/* GRIGLIA 2 COLONNE */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.archive-article {
    background: #fff;
    border: 1px solid var(--border);
    overflow: hidden;
}

.archive-thumb {
    display: block;
    overflow: hidden;
}

.archive-thumb img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s;
}

.archive-thumb:hover img {
    transform: scale(1.05);
}

.archive-article-content {
    padding: 1.5rem;
}

.archive-article-content h2 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.archive-article-content h2 a {
    color: var(--dark);
}

.archive-article-content h2 a:hover {
    color: var(--primary);
}

.archive-article-content p {
    color: var(--gray);
    margin: 0.8rem 0;
}

/* PAGINAZIONE */
.archive-pagination {
    text-align: center;
    margin-top: 3rem;
}

.archive-pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.2rem;
    background: var(--light-bg);
    color: var(--dark);
    border: 1px solid var(--border);
    text-decoration: none;
}

.archive-pagination .page-numbers.current,
.archive-pagination .page-numbers:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .archive-container {
        grid-template-columns: 1fr;
    }
    
    .archive-grid {
        grid-template-columns: 1fr;
    }
}

/* ARCHIVIO - SOLO FOTO E TITOLO COMPATTO */
.archive-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.archive-grid:last-of-type {
    margin-bottom: 3rem;
}

.archive-article {
    background: #fff;
    border: 1px solid var(--border);
    overflow: hidden;
}

.archive-thumb img {
    width: 100%;
    height: 180px !important;
    object-fit: cover;
}

.archive-article-content {
    padding: 1rem;
}

.archive-article-content .post-meta {
    font-size: 0.8rem;
    color: #999;
    margin-bottom: 0.3rem;
}

.archive-article-content h2 {
    font-size: 1.05rem !important;
    margin: 0;
    line-height: 1.3;
}

/* DATE DAPPERTUTTO */
.post-meta,
.entry-meta {
    font-size: 0.85rem;
    color: #999;
    margin: 0.5rem 0;
}

/* HOME - AGGIUNGIAMO DATE */
.hero-primo-content .post-meta,
.featured-content .post-meta,
.category-article .post-meta {
    display: block;
    margin-top: 0.5rem;
}

/* PAGINAZIONE MIGLIORATA */
.archive-pagination,
.pagination {
    margin-top: 3rem;
    text-align: center;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 1rem;
    background: #fff;
    color: var(--dark);
    border: 2px solid var(--border);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.page-numbers:hover,
.page-numbers.current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-numbers.prev,
.page-numbers.next {
    padding: 0.5rem 1.5rem;
}

.page-numbers.dots {
    border: none;
    background: transparent;
}

/* RICERCA HEADER */
.search-form-inline {
    display: flex;
    align-items: center;
    margin: 0;
}

.search-field-inline {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 3px 0 0 3px;
    font-size: 0.85rem;
    width: 150px;
}

.search-submit-inline {
    padding: 0.4rem 0.8rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 0 3px 3px 0;
    cursor: pointer;
    font-size: 0.85rem;
}

.search-submit-inline:hover {
    background: #a01830;
}

/* MENU HEADER - CSS GRID: logo | menu | ricerca (SOLO DESKTOP)
   Struttura HTML di .inside-header:
   1. div.site-branding        → col 1 (logo)
   2. nav.mobile-menu-control  → nascosto su desktop
   3. nav#site-navigation      → col 2 (menu centrato)
   4. div.header-search        → col 3 (ricerca)
*/
.site-header .inside-header {
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 769px) {
    .site-header .inside-header {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        grid-template-rows: 1fr !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        padding: 1rem 2rem !important;
        gap: 0 1.5rem !important;
    }

    /* Colonna 1: logo/titolo */
    .inside-header .site-branding {
        grid-column: 1;
        grid-row: 1;
        margin: 0;
        white-space: nowrap;
    }
}

/* Nasconde i toggle hamburger SOLO su desktop */
@media (min-width: 769px) {
    .inside-header nav.mobile-menu-control-wrapper,
    nav#site-navigation .menu-toggle {
        display: none !important;
    }
}

/* Colonna 2: menu principale centrato (solo desktop) */
@media (min-width: 769px) {
    .has-inline-mobile-toggle nav#site-navigation.main-navigation,
    nav#site-navigation.main-navigation {
        grid-column: 2 !important;
        grid-row: 1 !important;
        flex-basis: auto !important;
        width: auto !important;
    }
}

@media (min-width: 769px) {
    nav#site-navigation .inside-navigation {
        display: flex !important;
        justify-content: center;
        padding: 0 !important;
        margin: 0 !important;
    }

    nav#site-navigation .main-nav,
    nav#site-navigation .main-nav ul {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        list-style: none;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0;
    }

    nav#site-navigation .main-nav ul li {
        display: inline-block !important;
        margin: 0 !important;
        white-space: nowrap;
    }

    nav#site-navigation .main-nav ul li a {
        padding: 0.6rem 0.7rem;
        font-size: 0.8rem;
    }
}

/* Colonna 3: ricerca a destra (solo desktop) */
@media (min-width: 769px) {
    .inside-header .header-search {
        grid-column: 3;
        grid-row: 1;
        white-space: nowrap;
    }
}

/* DROPDOWN MENU */
nav#site-navigation .main-nav ul li {
    position: relative;
}

nav#site-navigation .main-nav ul ul.sub-menu {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
    flex-direction: column !important;
}

nav#site-navigation .main-nav ul li:hover > ul.sub-menu {
    display: flex !important;
}

nav#site-navigation .main-nav ul ul.sub-menu li {
    display: block !important;
    width: 100%;
    white-space: nowrap;
}

nav#site-navigation .main-nav ul ul.sub-menu li a {
    display: block;
    padding: 0.5rem 1.2rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 1px solid var(--light-bg);
}

nav#site-navigation .main-nav ul ul.sub-menu li:last-child a {
    border-bottom: none;
}

nav#site-navigation .main-nav ul ul.sub-menu li a:hover {
    background: var(--light-bg);
    color: var(--primary);
}

/* Freccia dropdown su NEWS - nasconde icona GP, usa la nostra */
nav#site-navigation .main-nav ul li.menu-item-has-children .dropdown-menu-toggle {
    display: none;
}

nav#site-navigation .main-nav ul li.menu-item-has-children > a::after {
    content: " ▾";
    font-size: 0.7rem;
}

/* PAGINA CONTATTI */
.contatti-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 3rem;
}

.contatti-container .sidebar {
    width: 360px;
}

.contatti-container .sidebar .widget {
    width: 100%;
    text-align: center;
}

.contatti-container .ads-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-placeholder {
    width: 336px;
    height: 280px;
    background: #e0e0e0;
    border: 1px dashed #999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #777;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0 auto 1.5rem;
}

.contatti-title {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.contatti-intro {
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

/* Messaggi di stato */
.form-message {
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
    font-weight: 600;
}

.form-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.form-error {
    background: #fce4ec;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* Form */
.contatti-form {
    background: var(--light-bg);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 3rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group-full {
    margin-bottom: 1.5rem;
}

.contatti-form label {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--dark);
}

.contatti-form .required {
    color: var(--primary);
}

.contatti-form input[type="text"],
.contatti-form input[type="email"],
.contatti-form input[type="tel"],
.contatti-form select,
.contatti-form textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    background: #fff;
    transition: border-color 0.2s;
}

.contatti-form input:focus,
.contatti-form select:focus,
.contatti-form textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

.contatti-form input[type="file"] {
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-label > span {
    flex: 1;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.checkbox-label a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.btn-invia {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.8rem 2.5rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.btn-invia:hover {
    background: #a01830;
}

/* Info cards sotto il form */
.contatti-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.info-card {
    background: #fff;
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
    padding: 1.5rem;
}

.info-card h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--gray);
    margin: 0;
    line-height: 1.7;
}

@media (max-width: 1024px) {
    .contatti-container {
        grid-template-columns: 1fr;
    }

    .contatti-container .sidebar {
        max-width: 360px;
        margin: 0 auto;
    }

    .ad-placeholder {
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .contatti-info {
        grid-template-columns: 1fr;
    }

    .contatti-title {
        font-size: 1.8rem;
    }

    .contatti-form {
        padding: 1.5rem;
    }
}

/* FIX BANNER CONTATTI - centrato */
.page-id-100 .sidebar .ad-placeholder {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ===== HEADER MOBILE (deve stare DOPO le regole grid desktop) ===== */
@media (max-width: 768px) {
    /* Disattiva il grid desktop, passa a colonna */
    .site-header .inside-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        padding: 0.8rem 1rem !important;
        gap: 0.5rem !important;
    }

    /* Logo visibile e centrato sopra il menu */
    .inside-header .site-branding {
        order: -1;
        text-align: center;
        width: 100%;
    }

    .header-logo {
        max-height: 45px;
        margin: 0 auto;
    }

    /* Mostra hamburger su mobile */
    .inside-header nav.mobile-menu-control-wrapper {
        display: flex !important;
        justify-content: center;
        width: 100%;
    }

    /* Nasconde il menu inline su mobile (mostrato dall'hamburger) */
    nav#site-navigation .main-nav > ul {
        display: none !important;
    }

    nav#site-navigation.toggled .main-nav > ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0.5rem 0 !important;
        margin: 0 !important;
        background: #fff;
    }

    /* Voci menu mobile: centrate, full-width, ben spaziate */
    nav#site-navigation.toggled .main-nav > ul > li {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        margin: 0 !important;
        border-bottom: 1px solid var(--border);
    }

    nav#site-navigation.toggled .main-nav > ul > li:last-child {
        border-bottom: none;
    }

    nav#site-navigation.toggled .main-nav > ul > li > a {
        display: block !important;
        width: 100% !important;
        padding: 14px 20px !important;
        text-align: center !important;
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: var(--dark) !important;
        box-sizing: border-box;
    }

    nav#site-navigation.toggled .main-nav > ul > li > a:hover,
    nav#site-navigation.toggled .main-nav > ul > li.current-menu-item > a {
        color: var(--primary) !important;
        background: var(--light-bg);
    }

    /* Sottomenu mobile: aperto sotto la voce padre, centrato */
    nav#site-navigation.toggled .main-nav ul ul.sub-menu {
        position: static !important;
        display: block !important;
        width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: var(--light-bg) !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    nav#site-navigation.toggled .main-nav ul ul.sub-menu li {
        width: 100% !important;
        text-align: center !important;
    }

    nav#site-navigation.toggled .main-nav ul ul.sub-menu li a {
        display: block !important;
        padding: 12px 20px !important;
        text-align: center !important;
        font-size: 0.85rem !important;
        color: var(--gray) !important;
        border-bottom: 1px solid var(--border) !important;
    }

    nav#site-navigation.toggled .main-nav ul ul.sub-menu li:last-child a {
        border-bottom: none !important;
    }

    /* Il nav stesso deve essere full-width e centrato */
    nav#site-navigation.toggled {
        width: 100% !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    nav#site-navigation.toggled .inside-navigation {
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Nasconde freccia dropdown su mobile */
    nav#site-navigation.toggled .main-nav ul li.menu-item-has-children > a::after {
        content: "" !important;
    }

    /* Ricerca sotto il menu */
    .inside-header .header-search {
        width: 100%;
        text-align: center;
    }

    .search-field-inline {
        width: 100%;
        max-width: 250px;
    }

    /* Banner mobile: centrato */
    .main-sponsor-header {
        margin: 1rem auto;
    }

    /* ===== HOME MOBILE: 2 articoli, immagini ridotte, banner inline ===== */

    /* Nasconde il 3° articolo su mobile */
    .category-article.mobile-hidden-article {
        display: none !important;
    }

    /* Griglia a 1 colonna su mobile */
    .category-grid {
        grid-template-columns: 1fr !important;
        gap: 1.2rem;
    }

    /* Altezza immagini ridotta su mobile */
    .category-thumb img {
        height: 170px !important;
    }

    .hero-primo-content h1 {
        font-size: 1.3rem !important;
        line-height: 1.4 !important;
    }

    .hero-primo-content p {
        font-size: 1rem !important;
    }

    .hero-primo-thumb img {
        height: 250px !important;
    }

    .featured-thumb img {
        height: 200px !important;
    }

    /* Banner inline tra sezioni (visibili solo su mobile) */
    .mobile-inline-banners {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1.5rem 0;
        border-bottom: 2px solid var(--border);
        margin-bottom: 1rem;
    }

    .mobile-inline-banners img {
        width: 100%;
        height: auto;
        max-width: 336px;
        object-fit: contain;
        display: block;
    }

    .mobile-inline-banners a {
        display: block;
        width: 100%;
        max-width: 336px;
        line-height: 0;
    }

    /* ===== ARTICOLO SINGOLO MOBILE ===== */

    .single-post .entry-title {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .entry-subtitle {
        font-size: 1rem !important;
    }

    .single-article-container {
        padding: 1rem !important;
        gap: 1.5rem !important;
    }

    .single-post .entry-content {
        font-size: 16px !important;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .single-post .entry-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ===== ARCHIVIO/CATEGORIA MOBILE ===== */

    /* Griglia a 1 colonna su mobile */
    .archive-grid {
        grid-template-columns: 1fr !important;
        gap: 1.2rem;
        margin-bottom: 1rem;
    }

    /* Altezza immagini archivio ridotta su mobile */
    .archive-thumb img {
        height: 170px !important;
    }

    .archive-container {
        padding: 1rem !important;
        gap: 1.5rem !important;
    }

    .archive-title {
        font-size: 1.6rem !important;
    }

    /* ===== CONTATTI MOBILE ===== */

    .contatti-container {
        padding: 1rem !important;
        gap: 1.5rem !important;
    }

    .contatti-title {
        font-size: 1.4rem !important;
    }

    .contatti-intro {
        font-size: 0.95rem !important;
    }

    .contatti-form {
        padding: 1rem !important;
    }

    .contatti-form input[type="text"],
    .contatti-form input[type="email"],
    .contatti-form input[type="tel"],
    .contatti-form select,
    .contatti-form textarea {
        font-size: 16px !important; /* previene zoom iOS */
    }

    .btn-invia {
        width: 100%;
        text-align: center;
    }

    .contatti-container .sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ===== SIDEBAR MOBILE (tutte le pagine) ===== */

    .sidebar,
    .single-sidebar {
        width: 100% !important;
        max-width: 100% !important;
    }

    .sidebar .widget,
    .single-sidebar .widget {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
    }

    /* Banner/ads: mai debordare */
    .ads-wrapper img,
    .widget_text img {
        width: 100% !important;
        max-width: 336px !important;
        height: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .ads-wrapper {
        align-items: center !important;
    }

    .ad-placeholder {
        width: 100% !important;
        max-width: 336px !important;
        height: auto !important;
        min-height: 200px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* ===== CONTAINER GENERALI MOBILE ===== */

    .magazine-container {
        padding: 1rem !important;
        gap: 1.5rem !important;
    }

    /* ===== FOOTER MOBILE ===== */

    .custom-footer {
        margin-top: 2rem !important;
        padding: 1.5rem 0 1rem !important;
    }

    .footer-container {
        padding: 0 1rem !important;
    }

    .footer-logo {
        max-height: 60px !important;
        margin: 0 auto 1rem !important;
    }

    .footer-col {
        text-align: center;
    }

    .footer-nav {
        text-align: center;
    }

    .footer-bottom {
        font-size: 0.8rem !important;
    }

    .footer-bottom p {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* ===== CORRELATI MOBILE ===== */

    .related-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .related-posts h3 {
        font-size: 1.2rem !important;
    }

    .related-card img {
        height: 100px !important;
    }

    .related-card h4 {
        font-size: 0.85rem !important;
    }

    .related-card-content {
        padding: 0.5rem !important;
    }

    /* ===== ANTI-OVERFLOW GLOBALE MOBILE ===== */

    img {
        max-width: 100%;
        height: auto;
    }

    table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }

    pre, code {
        overflow-x: auto;
        max-width: 100%;
        word-wrap: break-word;
    }
}
