/*
Theme Name: Casavacanze Theme
Description: Stile minimal/news con slider e sovrapposizione - Responsive Ready
*/

:root {
    --bg-dark: #0f1011;
    --badge-theme: #f9c21a;
    --text-dark: #1a1a1a;
    --text-grey: #6b7280;
    --border-color: #e5e7eb;
}

/* Fix per far funzionare lo sticky: cambiato 'hidden' con 'clip' */
body { margin: 0; font-family: 'Outfit', sans-serif; background-color: #fff; color: var(--text-dark); overflow-x: clip; }
a { text-decoration: none; transition: 0.2s ease; }
h1, h2, h3 { margin-top: 0; font-weight: 900; line-height: 1.2; }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.mb-15 { margin-bottom: 15px !important; }

/* === HEADER === */
/* 'display: contents' svincola l'header permettendo alla barra di agganciarsi al top della pagina */
.site-header { display: contents; }

.header-top { background: #fff; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 15px 5%; border-bottom: 1px solid #f3f4f6; font-size: 11px; text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }
.header-logo { grid-column: 2; text-align: center; }
.header-logo img { max-height: 100px; width: auto; object-fit: contain; display: block; margin: 0 auto; }
.header-logo a { font-size: 28px; font-weight: 900; letter-spacing: 4px; color: #000; }
.header-actions { grid-column: 3; justify-self: end; display: flex; gap: 20px; }

.lang-nav { list-style: none; padding: 0; margin: 0; display: flex; gap: 15px; align-items: center; }
.lang-nav li a { font-weight: 800; color: var(--text-dark); text-decoration: none; font-size: 13px; }
.lang-nav li a:hover { color: var(--badge-theme); }

/* BARRA STICKY FISSA AL TOP (Sia Desktop che Mobile) */
.header-bottom { 
    background: #fff; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 20px 5%; 
    position: sticky; 
    top: 0; 
    z-index: 1050; /* Z-index elevato per stare sopra l'overlay */
    border-bottom: 1px solid var(--border-color); 
    box-shadow: 0 4px 10px rgba(0,0,0,0.03); 
}

.mobile-menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 0; }
.header-nav ul { list-style: none; display: flex; gap: 40px; margin: 0; padding: 0; }
.header-nav a { color: var(--text-dark); font-size: 13px; text-transform: uppercase; font-weight: 600; }
.header-nav a:hover { color: var(--badge-theme); }

.header-search { position: absolute; right: 5%; }
.header-search-form { display: flex; align-items: center; border-bottom: 1px solid transparent; transition: border-color 0.3s ease; }
.header-search-form:focus-within { border-bottom-color: #000; }
.search-field { border: none; padding: 5px 10px; width: 0; opacity: 0; outline: none; background: transparent; font-family: 'Outfit', sans-serif; font-size: 14px; font-weight: 600; transition: width 0.4s ease, opacity 0.4s ease; }
.header-search-form:hover .search-field, .header-search-form:focus-within .search-field { width: 120px; opacity: 1; }
.header-search button { background: none; border: none; cursor: pointer; padding: 5px; display: flex; align-items: center; }

/* === OVERLAY SCURO MENU MOBILE === */
.menu-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); z-index: 1040; /* Sta SOTTO la header-bottom */
    opacity: 0; visibility: hidden; transition: 0.3s ease;
}
.menu-overlay.is-active { opacity: 1; visibility: visible; }
body.menu-open { overflow: hidden; }

/* === BADGES === */
.badge-theme { background-color: var(--badge-theme); color: #000; font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 5px 10px; display: inline-block; letter-spacing: 1px; }
.badge-absolute { position: absolute; top: 15px; left: 15px; z-index: 10; }
.ai-badge { position: absolute; bottom: 12px; right: 12px; background-color: rgba(0, 0, 0, 0.7); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 4px; z-index: 10; text-transform: uppercase; font-weight: 600; }

/* === HERO SECTION CON SLIDER E ZONA SICURA FRECCE === */
.hero-section { background-color: var(--bg-dark); padding: 80px 5% 40px 5%; }
/* Aggiunto padding-bottom: 80px per la zona di sicurezza delle frecce */
.hero-wrapper { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; padding-bottom: 80px; }

.hero-slide { grid-column: 1 / -1; grid-row: 1 / -1; display: flex; align-items: center; opacity: 0; visibility: hidden; z-index: 1; pointer-events: none; }
.hero-slide.active { opacity: 1; visibility: visible; z-index: 2; pointer-events: auto; }
.hero-content { flex: 0 0 55%; position: relative; z-index: 10; padding-right: 0; transform: translateX(-40px); opacity: 0; transition: transform 0.6s ease, opacity 0.6s ease; }
.hero-image { flex: 0 0 55%; margin-left: -10%; position: relative; z-index: 1; transform: scale(0.95) translateX(30px); opacity: 0; transition: transform 0.8s ease, opacity 0.8s ease; }
.hero-slide.active .hero-content { transform: translateX(0); opacity: 1; transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.3s, opacity 0.6s ease 0.3s; }
.hero-slide.active .hero-image { transform: scale(1) translateX(0); opacity: 1; transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1) 0s, opacity 0.8s ease 0s; }
.hero-image img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }

.category-badges { margin-bottom: 25px; display: flex; gap: 10px; }
.hero-title { font-size: 3.4rem; margin-bottom: 30px; letter-spacing: -1px; line-height: 1.35; }
.hero-title a { color: #fff; text-decoration: none; }
.hero-title a span { background-color: var(--bg-dark); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 5px 15px 5px 0; }
.hero-meta { display: flex; align-items: center; gap: 15px; font-size: 13px; color: #9ca3af; font-weight: 600; text-transform: uppercase; }

/* Frecce vincolate nella zona inferiore sicura */
.hero-slider-controls { position: absolute; bottom: 0; left: 0; display: flex; gap: 15px; z-index: 15; }
.slider-btn { background: transparent; color: var(--text-grey); border: 1px solid #333; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.slider-btn:hover { background: var(--badge-theme); color: #000; border-color: var(--badge-theme); transform: scale(1.05); }

/* === SEZIONI GENERALI === */
.content-section { padding: 60px 0; }
.section-header { margin-bottom: 40px; }
.section-title { font-size: 24px; margin-bottom: 10px; }
.section-desc { font-size: 15px; color: var(--text-grey); max-width: 100%; margin: 0; line-height: 1.6; }

.world-news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.news-card { display: flex; flex-direction: column; }
.card-image-wrap { position: relative; margin-bottom: 20px; }
.card-image-wrap img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.card-meta { font-size: 11px; color: var(--text-grey); font-weight: 600; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 20px; margin-bottom: 15px; }
.card-title a { color: inherit; }
.card-excerpt { font-size: 14px; color: var(--text-grey); line-height: 1.6; margin: 0; }

/* === GRIGLIA CATEGORIE (4 COLONNE) === */
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
.card-yellow { background-color: var(--badge-theme); color: var(--text-dark); padding: 35px 30px; display: flex; flex-direction: column; height: 100%; box-sizing: border-box; }
.card-yellow .card-text-wrap { display: flex; flex-direction: column; height: 100%; align-items: flex-start; }
.card-yellow .card-title { font-size: 22px; margin-bottom: 20px; }
.card-yellow .card-title a { color: var(--text-dark); }
.card-yellow .card-title a:hover { color: #000; text-decoration: underline; }
.card-yellow .card-excerpt { color: #333; flex-grow: 1; line-height: 1.6; margin: 0; }
.badge-inverse { background-color: var(--bg-dark); color: var(--badge-theme); font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 5px 10px; display: inline-block; letter-spacing: 1px; }

/* === RECENT NEWS (LISTA ORIZZONTALE) === */
.recent-news-list { display: flex; flex-direction: column; gap: 40px; margin-top: 20px; }
.recent-item { display: flex; gap: 40px; align-items: center; padding-bottom: 40px; border-bottom: 1px solid var(--border-color); }
.recent-item:last-child { border-bottom: none; }
.recent-image { flex: 0 0 45%; }
.recent-image img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.recent-content { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.recent-title { font-size: 28px; margin-bottom: 15px; line-height: 1.35; }
.recent-title a { color: var(--text-dark); }
.recent-title a:hover { color: var(--badge-theme); }
.recent-excerpt { font-size: 15px; color: var(--text-grey); line-height: 1.6; margin: 0 0 15px 0; }
.recent-meta { color: var(--text-grey); font-size: 14px; text-align: left; margin-top: 5px; }

/* === SEZIONE TESTO H1 === */
.h1-text-section { background-color: #f9fafb; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.h1-text-wrapper { max-width: 850px; margin: 0 auto; text-align: center; }
.main-h1-title { font-size: 38px; margin-bottom: 20px; color: var(--text-dark); line-height: 1.25; }
.main-h1-desc { font-size: 17px; color: var(--text-grey); line-height: 1.6; margin: 0; }

/* === PAGINAZIONE === */
.pagination { margin-top: 50px; margin-bottom: 30px; text-align: left; width: 100%; }
.pagination .nav-links { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 42px; padding: 0 15px; background-color: #f3f4f6; color: var(--text-dark); text-decoration: none; border-radius: 4px; font-weight: 800; font-size: 15px; transition: 0.2s ease; }
.pagination .page-numbers:hover { background-color: var(--badge-theme); color: #000; }
.pagination .page-numbers.current { background-color: var(--bg-dark); color: #fff; pointer-events: none; }
.pagination .page-numbers.dots { background-color: transparent; pointer-events: none; padding: 0 5px; }

/* === SINGLE POST E PAGINE === */
.single-container { max-width: 900px; margin: 60px auto; padding: 0 20px; }
.single-header { margin-bottom: 30px; }
.single-title { font-size: 4rem; font-weight: 900; line-height: 1.1; margin-bottom: 20px; color: var(--text-dark); letter-spacing: -1.5px; }
.single-excerpt { font-size: 1.25rem; color: var(--text-grey); line-height: 1.6; }
.single-separator { height: 1px; background-color: var(--border-color); margin: 40px 0; }
.single-featured-image { margin-bottom: 50px; position: relative; }
.single-featured-image img { width: 100%; height: auto; display: block; object-fit: cover; }
.single-content { font-size: 1.15rem; line-height: 1.8; color: #333; }
.single-content h2, .single-content h3, .single-content h4 { margin-top: 40px; margin-bottom: 20px; color: var(--text-dark); }
.single-content p { margin-bottom: 25px; }
.single-footer { margin-top: 60px; padding-top: 20px; border-top: 1px solid var(--border-color); font-size: 14px; color: var(--text-grey); }
.single-footer p { margin: 0; }
.single-footer strong { color: var(--text-dark); }

/* === FOOTER === */
.site-footer { background-color: var(--bg-dark); color: #9ca3af; padding: 80px 5% 30px 5%; margin-top: 60px; border-top: 4px solid var(--badge-theme); }
.footer-container { max-width: 1100px; margin: 0 auto; }
.footer-top { display: flex; justify-content: space-between; gap: 60px; padding-bottom: 50px; border-bottom: 1px solid #1f2937; }
.footer-col { flex: 1; }
.footer-col-about { flex: 1.5; }
.footer-logo { margin-bottom: 25px; }
.footer-logo img { max-width: 200px; height: auto; display: block; }
.footer-logo a { color: #fff; text-decoration: none; font-size: 32px; font-weight: 900; letter-spacing: 2px; }
.footer-about-text { line-height: 1.6; font-size: 15px; max-width: 90%; margin: 0; }
.footer-col h3 { color: #ffffff; font-size: 20px; margin-bottom: 25px; font-weight: 800; }
.footer-menu { list-style: none; padding: 0; margin: 0; }
.footer-menu li { margin-bottom: 15px; }
.footer-menu a { color: #9ca3af; text-decoration: none; transition: 0.3s ease; font-weight: 600; }
.footer-menu a:hover { color: var(--badge-theme); }
.footer-col-contacts ul { list-style: none; padding: 0; margin: 0; }
.footer-col-contacts li { margin-bottom: 15px; line-height: 1.5; font-size: 15px; }
.footer-col-contacts strong { color: #ffffff; font-weight: 800; }
.footer-bottom { text-align: center; padding-top: 30px; font-size: 13px; line-height: 1.8; color: #6b7280; }
.footer-bottom p { margin-bottom: 10px; }
.powered-by a { color: #ffffff; text-decoration: none; font-weight: 600; transition: color 0.3s ease; }
.powered-by a:hover { color: var(--badge-theme); }


/* =========================================
   MEDIA QUERIES (MOBILE E RESPONSIVE COMPLETO)
   ========================================= */

@media (max-width: 1200px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    
    /* --- Fix Header --- */
    .header-top { display: flex; justify-content: space-between; border-bottom: none; }
    .header-spacer { display: none; }
    .header-logo { text-align: left; }
    .header-logo img { max-height: 60px; }
    
    /* Mantiene la sticky bar solo sul blocco inferiore */
    .header-bottom { justify-content: flex-end; padding: 15px 5%; border-top: 1px solid var(--border-color); }
    .header-search { position: relative; right: auto; margin-left: auto; }
    
    /* Bottone Hamburger e Menu panino - Allineato verticalmente */
    .mobile-menu-toggle { 
        display: flex; 
        flex-direction: column; 
        justify-content: space-between; 
        width: 30px; 
        height: 22px; 
        z-index: 1100; 
        position: absolute;
        left: 5%;
        top: 50%;
        margin-top: -11px; /* Lo fissa perfettamente al centro della sticky bar */
    }
    
    .mobile-menu-toggle span { 
        display: block; 
        width: 100%; 
        height: 3px; 
        background-color: var(--text-dark); 
        transition: all 0.3s ease; 
        border-radius: 2px;
    }

    /* Trasformazione Hamburger in "X" fissa e sganciata dalla sticky bar per rimanere fissa sullo slide */
    .mobile-menu-toggle.is-active {
        position: fixed;
        top: 25px;
        margin-top: 0;
    }
    .mobile-menu-toggle.is-active span:nth-child(1) { transform: translateY(9.5px) rotate(45deg); }
    .mobile-menu-toggle.is-active span:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle.is-active span:nth-child(3) { transform: translateY(-9.5px) rotate(-45deg); }

    /* --- Slide-in Menu Laterale (Ora con priorità altissima e sfondo bianco forzato) --- */
    .header-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background-color: #fff !important; 
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
        z-index: 1045; /* Sotto la 'X' ma sopra l'overlay */
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 80px 30px 30px 30px; /* Crea lo spazio necessario sopra al testo per sfuggire alla "X" */
        overflow-y: auto;
        display: block !important; 
    }

    .header-nav.is-active { transform: translateX(0); }
    .header-nav ul { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
    .header-nav a { font-size: 16px; }

    /* --- Fix Hero Slide Mobile --- */
    .hero-section { padding: 40px 5% 40px 5%; }
    .hero-wrapper { padding-bottom: 70px; } /* Mantiene la zona sicura per le frecce su mobile */
    .hero-slider-controls { bottom: 0; }
    
    .hero-slide {
        flex-direction: column-reverse; 
        align-items: stretch;
        gap: 30px;
    }
    .hero-content, .hero-image {
        flex: auto;
        width: 100%;
        margin: 0;
        padding: 0;
        transform: none !important; 
        opacity: 1 !important;
    }
    
    .hero-slide:not(.active) .hero-content, 
    .hero-slide:not(.active) .hero-image {
        opacity: 0 !important;
    }
    
    .hero-title { font-size: 2.8rem; }
    .hero-title a span { padding: 0; }
    
    /* --- Fix Griglie Contenuti --- */
    .world-news-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    
    .recent-item { flex-direction: column; align-items: flex-start; gap: 20px; }
    .recent-image { flex: auto; width: 100%; }
}

@media (max-width: 768px) {
    .category-grid { grid-template-columns: 1fr; }
    
    .main-h1-title { font-size: 28px; }
    .main-h1-desc { font-size: 15px; }
    
    .single-title { font-size: 2.5rem; letter-spacing: -1px; }
    .single-excerpt { font-size: 1.15rem; }
    .single-container { margin: 40px auto; padding: 0 15px; }
    
    .footer-top { flex-direction: column; gap: 40px; }
    .footer-about-text { max-width: 100%; }
}