/* ==========================================================================
   ASSICOMUNALE — Global Color Consistency Fix
   Version: 1.2.1 — Hide empty blockquotes + hero height responsive bump (single-post)
   Purpose: replicare comportamento body.ac-home (reskin Purple Prima) su
            body.ac-blog-page, body.ac-blog-archive, body.ac-single-post,
            body.ac-service-page, body.ac-hub-page,
            body.ac-page-chi-siamo, body.ac-page-contatti, body.ac-page-lavora-con-noi
            e altre future body[class*="ac-page-"].

   Why: design-system.css default `h1-h6 {color: var(--ac-dark)}` + service.css
        override `body.ac-service-page .ac-section-header h2 {color: var(--ac-dark)}`
        forzano titoli midnight navy. Reskin-comunale.css override H2 SCOPED a
        body.ac-home solo. Risultato: drift cross-page (homepage purple H2 vs
        hub/service/blog midnight navy H2).

   Fix history:
   - v1.0.6: whitelist eccezioni dark/gradient ESTESA a body[class*="ac-page-"]
     + fallback greedy ristretto.
   - v1.0.7: rimosso .ac-reviews dalla whitelist body[class*="ac-page-"] (su queste
     pagine .ac-reviews ha bg trasparente, NO dark scoped). Aggiunta PART 5b per
     forzare H2 purple-700 brand-aligned.
   - v1.0.8: BUG MAJOR fix - PART 3 entry-content purple cascade-vinceva su PART 2
     white per stessa specificity ma source order successivo. Risultato: H2 dentro
     .ac-form-section / .ac-fullscreen-cta / .ac-reviews su service/hub/single
     erano purple-on-gradient/dark = FAIL contrast. Soluzione: spostato PART 2
     (white whitelist) DOPO PART 3 (entry-content purple) → cascade source order
     garantisce white vince su dark/gradient/cta sections. PART 5b ristretto a
     SOLO body.ac-page-chi-siamo/contatti/lavora-con-noi esplicit (no
     catch-all che colpiva service pages con body class composta).
   ========================================================================== */


/* ==========================================================================
   PART 1 — H2 PURPLE: section-header on whitelisted body class scope
   Applies var(--ac-primary-700) only on bodies where reskin homepage purple
   should propagate. NO fallback, NO :not greedy.
   ========================================================================== */
body.ac-blog-page .ac-section-header h2,
body.ac-blog-archive .ac-section-header h2,
body.ac-single-post .ac-section-header h2,
body.ac-service-page .ac-section-header h2,
body.ac-hub-page .ac-section-header h2 {
  color: var(--ac-primary-700) !important;
}


/* ==========================================================================
   PART 3 — ENTRY-CONTENT body H2/H3 (article body purple)
   Solo body class esplicite — no fallback greedy.
   NOTE: spostato PRIMA di PART 2 in v1.0.8 per cascade order corretto.
   ========================================================================== */
body.ac-blog-page .entry-content h2,
body.ac-blog-archive .entry-content h2,
body.ac-single-post .entry-content h2,
body.ac-service-page .entry-content h2,
body.ac-hub-page .entry-content h2,
body.ac-single-post .ac-single-content h2 {
  color: var(--ac-primary-700) !important;
}

body.ac-blog-page .entry-content h3,
body.ac-blog-archive .entry-content h3,
body.ac-single-post .entry-content h3,
body.ac-service-page .entry-content h3,
body.ac-hub-page .entry-content h3,
body.ac-single-post .ac-single-content h3 {
  color: var(--ac-primary-700) !important;
}


/* ==========================================================================
   PART 5b — body.ac-page-chi-siamo/contatti/lavora-con-noi .ac-reviews h2
   v1.0.8: scope ESPLICITO a 3 body class (no catch-all [class*="ac-page-"]
   che colpiva service pages con composite class come ac-page-polizza-rc-auto-bari).
   Su queste 3 pagine custom Elementor .ac-reviews ha bg trasparente (NO dark
   override scoped). H2 default cade su theme GeneratePress navy #0E508B.
   Allineo a purple-700 brand su bianco — ratio ~10:1 AA AAA.
   ========================================================================== */
body.ac-page-chi-siamo .ac-reviews h2,
body.ac-page-contatti .ac-reviews h2,
body.ac-page-lavora-con-noi .ac-reviews h2 {
  color: var(--ac-primary-700) !important;
}


/* ==========================================================================
   PART 2 — H2 WHITE: dark/gradient/cta-band sections (override readability)
   Posizionata DOPO PART 1/3/5b per cascade source order garantisce white vince
   su PART 3 entry-content purple quando H2 e' dentro section dark/gradient.
   Applies a tutte le body class previste + body[class*="ac-page-"] catch-all
   per pagine custom Elementor (chi-siamo/contatti/lavora-con-noi/altre).
   ========================================================================== */

/* Catch-all per body[class*="ac-page-"] — colpisce sia ac-page-chi-siamo che
   ac-page-polizza-rc-auto-bari (service composite class). Su service il PART 2
   scoped esplicito body.ac-service-page e' duplicato — no harm. */
body[class*="ac-page-"] .ac-section--gradient h2,
body[class*="ac-page-"] .ac-section--dark h2,
body[class*="ac-page-"] .ac-form-section h2,
body[class*="ac-page-"] .ac-fullscreen-cta h2,
body[class*="ac-page-"] .ac-cta-band h2,
body[class*="ac-page-"] .ac-cta-card h2,
body[class*="ac-page-"] [class*="cta-band"] h2,
body[class*="ac-page-"] [class*="cta-banner"] h2,
body[class*="ac-page-"] [class*="cta-card"] h2,
body[class*="ac-page-"] [class*="-fullscreen-cta"] h2,
body[class*="ac-page-"] [class*="--gradient"] h2,
body[class*="ac-page-"] [class*="--dark"] h2,
/* Whitelist scoped esistenti (mantenute intatte) */
body.ac-blog-page .ac-section--gradient h2,
body.ac-blog-archive .ac-section--gradient h2,
body.ac-single-post .ac-section--gradient h2,
body.ac-service-page .ac-section--gradient h2,
body.ac-hub-page .ac-section--gradient h2,
body.ac-blog-page .ac-section--dark h2,
body.ac-service-page .ac-section--dark h2,
body.ac-hub-page .ac-section--dark h2,
body.ac-blog-page [class*="cta-band"] h2,
body.ac-service-page [class*="cta-band"] h2,
body.ac-hub-page [class*="cta-band"] h2,
body.ac-single-post [class*="cta-band"] h2,
body.ac-single-post .ac-single-bottom-cta h2,
body.ac-blog-page .ac-blog-cta-banner h2,
body.ac-blog-archive .ac-blog-cta-banner h2,
body.ac-service-page .ac-form-section h2,
body.ac-hub-page .ac-form-section h2,
body.ac-blog-page .ac-form-section h2,
body.ac-single-post .ac-form-section h2,
body.ac-service-page .ac-cta-card h2,
body.ac-hub-page .ac-cta-card h2,
body.ac-blog-page .ac-cta-card h2,
body.ac-single-post .ac-cta-card h2,
body.ac-service-page .ac-service-cta-band h2,
body.ac-service-page .ac-fullscreen-cta h2,
body.ac-hub-page .ac-fullscreen-cta h2,
body.ac-blog-page .ac-fullscreen-cta h2,
body.ac-single-post .ac-fullscreen-cta h2,
body.ac-service-page .ac-reviews h2,
body.ac-hub-page .ac-reviews h2,
body.ac-blog-page .ac-reviews h2,
body.ac-single-post .ac-reviews h2 {
  color: #ffffff !important;
}


/* ==========================================================================
   PART 4 — FALLBACK ristretto (NON applica a body.ac-page-* o body.ac-home)
   v1.0.6: rimosso `body:not(.ac-home)` greedy. Scope esplicito solo a body
   class dove il design Purple Prima H2 e' desiderato.
   Eccezioni :not() preservate per safety contro markup inline ricorsivo.
   ========================================================================== */
body.ac-blog-page main h2:not(.ac-hero__title):not([class*="cta"]):not([class*="banner"]):not([class*="dark"]):not([class*="gradient"]):not([class*="--white"]):not([class*="hero"]),
body.ac-blog-archive main h2:not(.ac-hero__title):not([class*="cta"]):not([class*="banner"]):not([class*="dark"]):not([class*="gradient"]):not([class*="--white"]):not([class*="hero"]),
body.ac-single-post main h2:not(.ac-hero__title):not([class*="cta"]):not([class*="banner"]):not([class*="dark"]):not([class*="gradient"]):not([class*="--white"]):not([class*="hero"]) {
  color: var(--ac-primary-700);
}


/* ==========================================================================
   PART 5 — Hub partner-card body h2 (already purple-700 via reskin token)
   ========================================================================== */
body.ac-hub-page .ac-partner-card__body h2 {
  color: var(--ac-primary-700) !important;
}


/* ==========================================================================
   PART 7 — Header nav link cross-page (purple matching homepage)
   v1.1.1: ESTESO a TUTTE le pagine non-home (body:not(.ac-home)). Theme
   GeneratePress default link cyan #00AEEF colpisce nav su qualsiasi pagina
   non-home (body.ac-page-*, ac-blog-page, ac-single-post, ac-service-page,
   ac-hub-page, etc.). Override globale a #6B21A8 brand purple matching homepage.
   Esclusi i .ac-btn / button perche' gestiti da PART 8 con color logic.
   ========================================================================== */
body:not(.ac-home) header a:not(.ac-btn):not(.wp-block-button__link):not(.button),
body:not(.ac-home) .site-header a:not(.ac-btn):not(.wp-block-button__link):not(.button),
body:not(.ac-home) nav.main-navigation a:not(.ac-btn):not(.wp-block-button__link):not(.button),
body:not(.ac-home) .ac-nav__link,
body:not(.ac-home) .ac-mega__link {
  color: var(--ac-primary) !important; /* #6B21A8 */
}
/* Top bar phone/email/orari/social — WHITE su sfondo dark midnight purple
   v1.1.2: bug v1.1.1 mio forzava purple → invisible su dark top bar.
   Top bar ha bg --ac-dark / midnight purple → text deve essere bianco AA AAA. */
body:not(.ac-home) .ac-topbar a,
body:not(.ac-home) .ac-topbar,
body:not(.ac-home) .site-header__topbar a,
body:not(.ac-home) .site-header__topbar,
body:not(.ac-home) [class*="topbar"] a,
body:not(.ac-home) [class*="topbar"],
body:not(.ac-home) [class*="top-bar"] a,
body:not(.ac-home) [class*="top-bar"] {
  color: #ffffff !important; /* white on dark top bar — AA AAA */
}
/* Top bar SVG icons (social/phone/email/orari) — white via currentColor or fill */
body:not(.ac-home) .ac-topbar svg,
body:not(.ac-home) [class*="topbar"] svg,
body:not(.ac-home) [class*="top-bar"] svg {
  color: #ffffff !important;
  fill: #ffffff !important;
}


/* ==========================================================================
   PART 8 — Header CTA button color logic (FIX v1.1.1 pink-on-pink invisible)
   v1.1.0 BUG: forzato pink su TUTTI .ac-btn header → button .ac-btn--primary
   (bg pink) diventava pink-on-pink invisible. Fix: color logic by button class.
   - .ac-btn--white (bg white) → text pink
   - .ac-btn--primary / .ac-btn--accent (bg pink) → text WHITE
   - .ac-btn--ghost (transparent) → text purple
   ========================================================================== */
body:not(.ac-home) header .ac-btn--white,
body:not(.ac-home) header a.ac-btn--white,
body:not(.ac-home) .site-header .ac-btn--white,
body:not(.ac-home) .site-header a.ac-btn--white {
  color: var(--ac-accent) !important; /* #EC4899 pink text on white bg */
  background-color: #ffffff !important;
  border-color: var(--ac-accent) !important;
}
body:not(.ac-home) header .ac-btn--primary,
body:not(.ac-home) header a.ac-btn--primary,
body:not(.ac-home) header .ac-btn--accent,
body:not(.ac-home) header a.ac-btn--accent,
body:not(.ac-home) .site-header .ac-btn--primary,
body:not(.ac-home) .site-header a.ac-btn--primary,
body:not(.ac-home) .site-header .ac-btn--accent,
body:not(.ac-home) .site-header a.ac-btn--accent {
  color: #ffffff !important; /* WHITE text on pink bg — fix invisible bug */
}
body:not(.ac-home) header .ac-btn--ghost,
body:not(.ac-home) header a.ac-btn--ghost,
body:not(.ac-home) .site-header .ac-btn--ghost {
  color: var(--ac-primary) !important;
  background: transparent !important;
}


/* ==========================================================================
   PART 8 — Hero buttons chi-siamo (matching homepage pattern: pink/white)
   v1.1.0: theme `a {color: cyan #00AEEF}` colpisce .ac-btn--accent/--ghost
   nell'hero chi-siamo. Override scoped per allineare a homepage.
   ========================================================================== */
body.ac-page-chi-siamo .ac-about__hero .ac-btn--accent,
body.ac-page-chi-siamo .ac-about__hero a.ac-btn--accent {
  color: #ffffff !important;
  background: var(--ac-accent) !important; /* #EC4899 pink */
  border-color: var(--ac-accent) !important;
}
body.ac-page-chi-siamo .ac-about__hero .ac-btn--accent:hover {
  background: var(--ac-accent-hover) !important; /* #DB2777 darker pink */
  border-color: var(--ac-accent-hover) !important;
}
body.ac-page-chi-siamo .ac-about__hero .ac-btn--ghost,
body.ac-page-chi-siamo .ac-about__hero a.ac-btn--ghost {
  color: #ffffff !important;
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.8) !important;
}
body.ac-page-chi-siamo .ac-about__hero .ac-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: #ffffff !important;
}


/* ==========================================================================
   PART 9 — H2 main cross-page brand purple (matches homepage --ac-primary)
   v1.1.0: about-page.css/contact-page.css/lavora-page.css definiscono H2
   color hardcoded #3B0764 (purple-800 dark) o cadono su theme #0E508B navy.
   Override per allineare a #6B21A8 (--ac-primary) matching homepage H2.
   IMPORTANT: PART 2 (white whitelist su dark/gradient sections) viene DOPO
   nel file → vince su sezioni dark/gradient/cta-band. Cascade safe.
   ========================================================================== */
body.ac-page-chi-siamo main h2,
body.ac-page-contatti main h2,
body.ac-page-lavora-con-noi main h2 {
  color: var(--ac-primary) !important; /* #6B21A8 brand */
}


/* ==========================================================================
   PART 10 — H3 main cross-page brand purple-700
   v1.1.0: H3 hardcoded #3B0764 → align a #4C1D95 (--ac-primary-700) matching
   homepage H3. PART 2 white override scoped a [class*="cta"]/[class*="--dark"]
   etc su body.ac-page-* — i singoli h3 dentro section dark/gradient andrebbero
   gestiti manualmente se necessario (rare).
   ========================================================================== */
body.ac-page-chi-siamo main h3,
body.ac-page-contatti main h3,
body.ac-page-lavora-con-noi main h3 {
  color: var(--ac-primary-700) !important; /* #4C1D95 */
}


/* ==========================================================================
   PART 11 — Footer text cross-page dark midnight purple (matches homepage)
   v1.1.0: theme default body color colpisce footer su body.ac-page-* (gray
   #374151 / black #000000). Override a --ac-dark #1E1B4B per match homepage.
   ========================================================================== */
body.ac-page-chi-siamo footer,
body.ac-page-contatti footer,
body.ac-page-lavora-con-noi footer,
body.ac-page-chi-siamo .site-footer,
body.ac-page-contatti .site-footer,
body.ac-page-lavora-con-noi .site-footer {
  color: var(--ac-dark) !important; /* #1E1B4B */
}


/* ==========================================================================
   PART 12 — Indicazioni Stradali in single post (replica stile service page)
   v1.2.0: negli articoli single post il markup directions e' Gutenberg native
   <details class="wp-block-details"> SENZA wrapper canonical .ac-service-directions.
   Replica visivamente body.ac-service-page .ac-service-directions-item premium.
   Target: body.ac-single-post .ac-single-content details.wp-block-details.
   ========================================================================== */
body.ac-single-post .ac-single-content details.wp-block-details {
  border: 1px solid var(--ac-primary-100, #EDE5FF);
  border-radius: var(--ac-radius-md, 12px);
  background: #fff;
  overflow: hidden;
  margin: 0 0 12px 0;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  padding: 0 !important;
}
body.ac-single-post .ac-single-content details.wp-block-details:hover {
  border-color: var(--ac-primary-300, #C4B5FD);
}
body.ac-single-post .ac-single-content details.wp-block-details[open] {
  border-color: var(--ac-primary-500, #6B21A8);
  box-shadow: 0 4px 16px rgba(107, 33, 168, 0.12);
}
body.ac-single-post .ac-single-content details.wp-block-details > summary {
  list-style: none;
  padding: 20px 24px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  position: relative;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ac-dark, #1E1B4B);
  transition: color 0.3s ease;
}
body.ac-single-post .ac-single-content details.wp-block-details > summary::-webkit-details-marker,
body.ac-single-post .ac-single-content details.wp-block-details > summary::marker {
  display: none;
  content: '';
}
body.ac-single-post .ac-single-content details.wp-block-details:hover > summary {
  color: var(--ac-primary-500, #6B21A8);
}
body.ac-single-post .ac-single-content details.wp-block-details > summary::after {
  content: '+';
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ac-primary-50, #F5F0FF);
  color: var(--ac-primary-500, #6B21A8);
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
}
body.ac-single-post .ac-single-content details.wp-block-details[open] > summary {
  color: var(--ac-primary-500, #6B21A8);
}
body.ac-single-post .ac-single-content details.wp-block-details[open] > summary::after {
  transform: rotate(45deg);
  background: var(--ac-primary-500, #6B21A8);
  color: #fff;
}
body.ac-single-post .ac-single-content details.wp-block-details > summary:focus-visible {
  outline: 3px solid var(--ac-accent, #EC4899);
  outline-offset: -3px;
}
/* Hide raw <a> empty anchors injected by Gutenberg in summary (Da Bitonto markup) */
body.ac-single-post .ac-single-content details.wp-block-details > summary > a:empty {
  display: none;
}
body.ac-single-post .ac-single-content details.wp-block-details > summary > a {
  color: inherit !important;
  text-decoration: none !important;
}
/* Body content (ul) */
body.ac-single-post .ac-single-content details.wp-block-details > ul,
body.ac-single-post .ac-single-content details.wp-block-details > ul.wp-block-list {
  padding: 0 24px 20px 48px;
  margin: 0;
  list-style: disc;
}
body.ac-single-post .ac-single-content details.wp-block-details li {
  padding-block: 8px;
  color: var(--ac-body, #4B5563);
  line-height: 1.6;
}
body.ac-single-post .ac-single-content details.wp-block-details li > a {
  color: var(--ac-primary-700, #4C1D95) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.3s ease;
}
body.ac-single-post .ac-single-content details.wp-block-details li > a:hover {
  color: var(--ac-primary-500, #6B21A8) !important;
}
/* Spacer between consecutive details (gap visual) */
body.ac-single-post .ac-single-content details.wp-block-details + details.wp-block-details {
  margin-top: 12px;
}

/* ==========================================================================
   PART 13 — Hide empty <blockquote> containing only Gutenberg spacers
   v1.2.1: audit identified 18/37 single posts with blockquote.wp-block-quote
   containing ONLY <div.wp-block-spacer> (lost quote content during migration).
   Renders as empty purple-50 rectangle with left-border purple = visual noise.
   :has() selector for browsers >= Chrome 105 / Firefox 121 / Safari 15.4.
   ========================================================================== */
body.ac-single-post .ac-single-content blockquote.wp-block-quote:has(> div.wp-block-spacer:only-child) {
  display: none !important;
}
body.ac-single-post .ac-single-content blockquote.wp-block-quote:has(> .wp-block-spacer:only-child) {
  display: none !important;
}


/* ==========================================================================
   PART 6 — Article body links (brand purple, hover pink)
   ========================================================================== */
body.ac-blog-page .entry-content a,
body.ac-blog-archive .entry-content a,
body.ac-single-post .ac-single-content a,
body.ac-service-page .entry-content a,
body.ac-hub-page .entry-content a {
  color: var(--ac-primary-700);
}
body.ac-blog-page .entry-content a:hover,
body.ac-blog-archive .entry-content a:hover,
body.ac-single-post .ac-single-content a:hover,
body.ac-service-page .entry-content a:hover,
body.ac-hub-page .entry-content a:hover {
  color: var(--ac-accent-600);
}
