.elementor-299 .elementor-element.elementor-element-bcda1dd{--display:flex;}/* Start custom CSS for html, class: .elementor-element-777df13 */from pathlib import Path
import re, subprocess

src = Path("/mnt/data/AZXPrime-Site-Principal-Links-Atualizados.html")
html = src.read_text(encoding="utf-8")

typography_css = r'''
<style id="azx-typography-optimized">
/* =========================================================
   OTIMIZAÇÃO TIPOGRÁFICA — REDUÇÃO DOS TEXTOS GRANDES
   Conteúdo preservado. Apenas tamanho de fonte ajustado.
   ========================================================= */

/* Hero principal: ~20% menor */
.azx-hero h1{
  font-size:clamp(34px,4vw,56px)!important;
  line-height:1.04!important;
  letter-spacing:-.048em!important;
}

/* Títulos gerais das seções */
.azx-title{
  font-size:clamp(31px,4vw,54px)!important;
  line-height:1.06!important;
  letter-spacing:-.047em!important;
}

.azx-title.small,
.azx-title.azx-title-small{
  font-size:clamp(26px,3.2vw,42px)!important;
  line-height:1.08!important;
  letter-spacing:-.042em!important;
}

.azx-title.xsmall{
  font-size:clamp(23px,2.5vw,34px)!important;
  line-height:1.10!important;
}

/* Cards grandes de áreas */
.azx-care-card h3{
  font-size:clamp(23px,2.4vw,31px)!important;
  line-height:1.10!important;
}

/* Cards de processo */
.azx-process-card h3{
  font-size:16px!important;
  line-height:1.25!important;
}

/* Cards menores */
.azx-area-mini-card h3,
.azx-benefit h3{
  font-size:15px!important;
  line-height:1.25!important;
}

/* AZFIT */
.azx-azfit-copy strong{
  font-size:19px!important;
  line-height:1.24!important;
}

.azx-azfit-stat strong{
  font-size:16px!important;
}

/* Especialidades */
.azx-specialty-clinic-card h3{
  font-size:21px!important;
  line-height:1.15!important;
}

/* CTA final / painéis */
.azx-cta-panel h3{
  font-size:clamp(21px,2.3vw,29px)!important;
  line-height:1.12!important;
}

/* Hero caption */
.azx-hero-caption strong{
  font-size:15px!important;
}

/* Textos de apoio grandes também levemente reduzidos */
.azx-hero-description{
  font-size:clamp(14px,1.2vw,16px)!important;
  line-height:1.70!important;
}

.azx-lead{
  font-size:clamp(14px,1.25vw,16px)!important;
  line-height:1.70!important;
}

/* Melhor encaixe vertical sem alterar textos */
.azx-section{
  padding:clamp(70px,7vw,104px) 0!important;
}

.azx-section-head{
  margin-bottom:42px!important;
}

.azx-care-card{
  min-height:430px!important;
}

.azx-care-card-content{
  min-height:430px!important;
}

.azx-process-card{
  min-height:245px!important;
}

.azx-specialty-clinic-card{
  min-height:310px!important;
}

/* Tablet */
@media(max-width:900px){
  .azx-hero h1{
    font-size:clamp(32px,6vw,46px)!important;
  }

  .azx-title{
    font-size:clamp(29px,5vw,43px)!important;
  }

  .azx-title.small,
  .azx-title.azx-title-small{
    font-size:clamp(25px,4.6vw,36px)!important;
  }

  .azx-care-card h3{
    font-size:27px!important;
  }
}

/* Mobile */
@media(max-width:650px){
  .azx-section{
    padding:58px 0!important;
  }

  .azx-hero h1{
    font-size:clamp(30px,8vw,38px)!important;
    line-height:1.06!important;
  }

  .azx-title{
    font-size:clamp(27px,7vw,36px)!important;
    line-height:1.08!important;
  }

  .azx-title.small,
  .azx-title.azx-title-small{
    font-size:clamp(24px,6.5vw,31px)!important;
    line-height:1.10!important;
  }

  .azx-title.xsmall{
    font-size:clamp(22px,6vw,28px)!important;
  }

  .azx-care-card h3{
    font-size:25px!important;
  }

  .azx-cta-panel h3{
    font-size:23px!important;
  }

  .azx-specialty-clinic-card h3{
    font-size:20px!important;
  }

  .azx-hero-description,
  .azx-lead{
    font-size:14px!important;
  }

  .azx-care-card,
  .azx-care-card-content{
    min-height:385px!important;
  }
}
</style>
'''

html = html.replace("</head>", typography_css + "\n</head>", 1)

# Validate JS
for i, script in enumerate(re.findall(r"<script>(.*?)</script>", html, flags=re.S), 1):
    if not script.strip():
        continue
    js_path = Path(f"/tmp/azx_home_typography_{i}.js")
    js_path.write_text(script, encoding="utf-8")
    result = subprocess.run(
        ["node", "--check", str(js_path)],
        capture_output=True,
        text=True
    )
    if result.returncode != 0:
        raise RuntimeError(f"Erro JS no bloco {i}: {result.stderr}")

out_html = Path("/mnt/data/AZXPrime-Site-Principal-Tipografia-Otimizada.html")
out_txt = Path("/mnt/data/AZXPrime-Site-Principal-Tipografia-Otimizada.txt")

out_html.write_text(html, encoding="utf-8")
out_txt.write_text(html, encoding="utf-8")

print({
    "html": str(out_html),
    "txt": str(out_txt),
    "hero_max": "56px",
    "section_title_max": "54px",
    "small_title_max": "42px",
    "mobile_hero_max": "38px",
    "conteudo_textual_alterado": False,
    "js_valido": True
})/* End custom CSS */