/* ==========================================================================
   SISTEMA CENTRALE CSS - STUDIO NOTARILE COLOSIMO
   Core, Home, Approfondimenti, Header, Team & Mobile Fix Definitivi
   ========================================================================== */

/* ==========================================================================
   0. RETE DI SICUREZZA GLOBALE (Antisbordamento)
   ========================================================================== */
html, body {
    max-width: 100vw !important;
    overflow-x: clip !important; 
    box-sizing: border-box !important;
}

*, *::before, *::after {
    box-sizing: inherit;
}

html { 
    scroll-behavior: smooth !important; 
}

/* ==========================================================================
   1. BASE TARGA ISTITUZIONALE GLOBALE & HERO
   ========================================================================== */
.targa-studio {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 50px;
    background: #ffffff !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08) !important;
    border-top: 5px solid #c5a059 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.targa-studio:hover {
    transform: scale(1.015) !important;
    box-shadow: 0 25px 50px rgba(26, 42, 64, 0.14) !important;
}

.targa-statica:hover {
    transform: none !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08) !important;
}

.targa-studio::after {
    content: "";
    display: block;
    width: 100%;
    height: 54px;
    margin-top: auto;
    background: linear-gradient(165deg, #0f1b29 0%, #1e304a 25%, #122033 50%, #253d5e 75%, #0b131f 100%) !important;
}

@keyframes respiroSfondo {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.sfondo-hero {
    animation: respiroSfondo 20s ease-in-out infinite alternate;
}

/* Simmetria Bottoni Hero */
.hero-studio .wp-block-button__link,
.hero-studio a {
    min-width: 250px !important; 
    text-align: center !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.hero-studio a:hover {
    background: #ffffff !important;
    color: #1a2a40 !important;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15) !important;
}

/* Mobile Fix: Bottoni Hero */
@media (max-width: 768px) {
    .hero-studio .wp-block-buttons {
        flex-direction: column !important;
        width: 100%;
    }
    .hero-studio .wp-block-button__link,
    .hero-studio a {
        min-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ==========================================================================
   2. AREE DI ATTIVITA' E METRICHE (HOME)
   ========================================================================== */
.sezione-attivita {
    padding: 50px 20px;
    background-color: #eef1f6; 
    width: 100% !important;
    box-sizing: border-box !important;
}

.titolo-sezione h2 {
    color: #1a2a40;
    font-size: clamp(32px, 4vw, 42px);
    font-family: 'Playfair Display', serif;
    font-weight: bold;
    margin: 0 0 15px 0;
    text-align: center;
}

.linea-oro {
    width: 60px;
    height: 3px;
    background: #c5a059;
    margin: 0 auto 50px;
}

.griglia-attivita {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px; 
    max-width: 950px; 
    margin: 0 auto;
    width: 100% !important;
}

.card-attivita {
    background: #ffffff;
    padding: 35px 30px; 
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    border-top: 4px solid #1a2a40;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box !important;
}

.card-attivita:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    border-top-color: #c5a059; 
}

.card-attivita h3 {
    color: #1a2a40;
    font-family: 'Playfair Display', serif;
    font-size: 20px; 
    margin: 20px 0 10px 0;
    font-weight: bold;
}

.card-attivita p {
    color: #555;
    line-height: 1.7;
    font-size: 15px;
}

.link-attivita { display: none !important; }

/* FIX MOBILE: Griglia Attività che sbordava */
@media (max-width: 850px) {
    .griglia-attivita { 
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    } 
    .sezione-attivita { padding: 40px 15px !important; }
    .card-attivita { 
        width: 100% !important;
        max-width: 100vw !important;
        padding: 25px 20px !important; 
        margin: 0 !important;
    }
}

/* --- Metriche --- */
.sezione-metriche {
    background-color: #1a2a40; 
    padding: 30px 20px; 
    position: relative;
    width: 100% !important;
    box-sizing: border-box !important;
}

.sezione-metriche::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: #c5a059;
}

.griglia-metriche {
    display: flex; 
    flex-wrap: wrap;
    justify-content: center; 
    gap: 60px; 
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.numero-metrica {
    font-size: clamp(34px, 4vw, 48px); 
    font-weight: bold;
    color: #c5a059;
    font-family: 'Playfair Display', serif;
    margin-bottom: 10px;
    line-height: 1;
}

.testo-metrica {
    color: #ffffff;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
}

/* Mobile Fix: Metriche */
@media (max-width: 600px) {
    .griglia-metriche { gap: 30px; flex-direction: column; align-items: center; }
    .blocco-metrica { padding: 10px; width: 100%; }
}

/* ==========================================================================
   3. OVERRIDES STRUTTURALI E HEADER STICKY
   ========================================================================== */
.forza-schermo-intero {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
}

header, .site-header, #masthead {
    width: 100% !important;
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
    background-color: transparent !important; 
    transition: all 0.4s ease-in-out !important;
}

body.admin-bar header { top: 32px !important; }

header img, .custom-logo {
    max-height: 80px; 
    width: auto !important;
    transition: max-height 0.4s ease-in-out !important; 
}

/* --- Stato Header Compresso --- */
.header-compresso {
    padding-top: 0 !important;    
    padding-bottom: 0 !important; 
}

.header-compresso .main-header-bar,
.header-compresso .inside-header {
    min-height: 30px !important; 
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.header-compresso img, 
.header-compresso .custom-logo { max-height: 35px !important; }

.header-compresso .main-navigation a,
.header-compresso li { line-height: 30px !important; }

/* ==========================================================================
   4. RICERCA HEADER PRO (Desktop & Mobile con Sovrapposizione e NO-ZOOM)
   ========================================================================== */
/* DESKTOP */
@media (min-width: 769px) {
    .header-search .wp-block-search__inside-wrapper {
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 50px !important;
        background-color: rgba(255, 255, 255, 0.1) !important; 
        width: 180px; 
        transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        overflow: hidden;
    }
    
    .header-search input.wp-block-search__input {
        background: transparent !important;
        border: none !important;
        color: #ffffff !important;
        padding-left: 20px !important;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }
    
    .header-search input.wp-block-search__input::placeholder { color: rgba(255, 255, 255, 0.6) !important; }
    
    .header-search .wp-block-search__button {
        background: transparent !important;
        color: #ffffff !important;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }
    
    .header-search .wp-block-search__inside-wrapper:focus-within {
        width: 250px; 
        background-color: #ffffff !important; 
        border-color: #c5a059 !important; 
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); 
    }
    
    .header-search .wp-block-search__inside-wrapper:focus-within input.wp-block-search__input,
    .header-search .wp-block-search__inside-wrapper:focus-within .wp-block-search__button {
        color: #1a2a40 !important; 
    }
}

/* FIX MOBILE DEFINITIVO: Ricerca a scomparsa, tocco abilitato e blocco zoom iOS */
@media (max-width: 768px) {
    header img, .site-header img, #masthead img, .custom-logo { max-height: 55px !important; }

    .header-search .wp-block-search__inside-wrapper { 
        width: 38px !important; 
        height: 38px !important;
        border-radius: 50% !important; 
        padding: 0 !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        transition: all 0.3s ease;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: relative !important;
    }
    
    /* Il testo invisibile sta SOPRA alla lente per intercettare il tocco */
    .header-search input.wp-block-search__input {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        opacity: 0 !important;
        z-index: 5 !important;
        padding: 0 !important;
        border: none !important;
        cursor: pointer;
        font-size: 16px !important; /* <--- BLOCCO ZOOM AUTOMATICO APPLE iOS */
    }

    .header-search .wp-block-search__button {
        width: 38px !important; height: 38px !important;
        padding: 0 !important; margin: 0 !important;
        background: transparent !important; color: white !important;
        display: flex !important; align-items: center !important; justify-content: center !important;
        position: relative !important;
        z-index: 1 !important; 
        pointer-events: none !important; 
    }

    /* Espansione della barra */
    .header-search .wp-block-search__inside-wrapper:focus-within { 
        width: calc(100vw - 80px) !important;
        max-width: 280px !important;
        border-radius: 50px !important; 
        position: absolute; right: 15px; 
        z-index: 9999;
        background-color: white !important;
    }

    /* Riappare il testo */
    .header-search .wp-block-search__inside-wrapper:focus-within input.wp-block-search__input {
        position: relative !important;
        width: 100% !important;
        padding-left: 15px !important;
        opacity: 1 !important;
        z-index: 1 !important;
        color: #1a2a40 !important;
        cursor: text;
        font-size: 16px !important; /* <--- BLOCCO ZOOM AUTOMATICO APPLE iOS */
    }
    
    .header-search .wp-block-search__inside-wrapper:focus-within .wp-block-search__button {
        color: #1a2a40 !important;
        pointer-events: auto !important;
    }
}

/* ==========================================================================
   5. ARCHIVIO APPROFONDIMENTI
   ========================================================================== */
.archivio-notarile .wp-block-post {
    border-bottom: 1px solid #eef2f5;
    padding: 20px 25px !important; 
    margin: 0 0 10px 0 !important; 
    border-radius: 6px;
    background-color: transparent;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}

.archivio-notarile .wp-block-post:hover {
    background-color: #f8fafc; 
    padding-left: 35px !important; 
    border-left: 3px solid #c5a059; 
}

.archivio-notarile .wp-block-post-title {
    font-family: 'Georgia', 'Times New Roman', serif !important;
    font-size: 2.1rem !important;
    margin: 10px 0 15px 0 !important;
}

.archivio-notarile .wp-block-post-title a { color: #1a2a40 !important; text-decoration: none !important; }
.archivio-notarile .wp-block-post:hover .wp-block-post-title a { color: #0f1b29 !important; }

.archivio-notarile .wp-block-post-date {
    font-size: 0.78rem !important; color: #94a3b8; text-transform: uppercase;
}
.archivio-notarile .wp-block-post-excerpt { color: #475569; line-height: 1.7; max-width: 680px; }

/* Sidebar */
.sidebar-notarile {
    padding: 35px !important; background-color: #f8fafc; border-radius: 8px;
    position: sticky; top: 100px; align-self: start; 
}

.sidebar-notarile h2, .sidebar-notarile h3 {
    font-size: 0.9rem !important; color: #1a2a40; border-bottom: 2px solid #c5a059; 
    padding-bottom: 8px; text-transform: uppercase; margin-bottom: 20px; display: block;
}

.sidebar-notarile ul { list-style: none !important; padding-left: 0; }
.sidebar-notarile li { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.sidebar-notarile li:last-child { border-bottom: none; }
.sidebar-notarile a { color: #555555; text-decoration: none; transition: color 0.2s; }
.sidebar-notarile a:hover { color: #c5a059; font-weight: bold; }

/* Mobile Fix: Approfondimenti */
@media (max-width: 800px) {
    .sidebar-notarile { padding: 20px !important; margin-top: 40px; position: static; background-color: transparent;}
    .archivio-notarile .wp-block-post { padding: 15px 10px !important; }
    .archivio-notarile .wp-block-post:hover { padding-left: 10px !important; border-left: none; }
    .archivio-notarile .wp-block-post-title { font-size: 1.6rem !important; }
}

/* ==========================================================================
   6. TEAM E FOTO PROFILO
   ========================================================================== */
.contenitore-shining {
    border-radius: 50% !important;
    overflow: hidden !important; 
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15), inset 0 0 0 8px rgba(255, 255, 255, 0.4) !important;
    transition: all 0.4s ease !important;
    position: relative;
    margin: 0 auto;
}

.contenitore-shining > div { border-radius: 50% !important; }

.targa-studio:hover .contenitore-shining {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), inset 0 0 0 4px rgba(255, 255, 255, 0.8) !important;
    transform: scale(1.03);
}

@media (max-width: 768px) {
    .targa-studio > div > div {
        min-width: 100% !important; 
        width: 100% !important;
        padding: 25px 15px !important; 
        text-align: center !important; 
        box-sizing: border-box !important;
    }
    
    .targa-studio > div > div:first-child { padding-bottom: 0 !important; }
    
    .contenitore-shining { width: 180px !important; height: 180px !important; }
    .targa-studio h3 { font-size: 22px !important; }
    .targa-studio h3 + div { margin: 15px auto !important; }
}

/* ==========================================================================
   7. FIX FOOTER MOBILE (Allineamento Globale)
   ========================================================================== */
@media (max-width: 768px) {
    footer, .site-footer {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    footer .wp-block-columns {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 30px !important;
        width: 100% !important;
        padding-left: 20px !important; 
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }
    
    footer .wp-block-column {
        width: 100% !important;
        margin-left: 0 !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    footer .wp-block-image {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        margin-bottom: 15px !important;
    }
    
    footer p, footer a {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}