#gg-indice-artigos{font-family:'Montserrat',sans-serif;padding:56px 32px 64px;background:#f9f9f7;border-top:4px solid #0a280f;}
#gg-indice-titulo{text-align:center;font-size:28px;font-weight:800;color:#0a280f;letter-spacing:1px;text-transform:uppercase;margin-bottom:8px;}
#gg-indice-subtitulo{text-align:center;font-size:14px;color:#777;margin-bottom:40px;}
.gg-cat-bloco{margin-bottom:32px;border-radius:10px;overflow:hidden;box-shadow:0 2px 14px rgba(0,0,0,.07);}
.gg-cat-header{background:#0a280f;padding:14px 24px;display:flex;align-items:center;gap:10px;}
.gg-cat-icon{font-size:20px;}
.gg-cat-nome{color:#C5A44E;font-size:15px;font-weight:700;text-transform:uppercase;letter-spacing:1.2px;flex:1;}
.gg-cat-count{background:#C5A44E;color:#fff;border-radius:20px;padding:2px 10px;font-size:12px;font-weight:700;}
.gg-links-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));background:#fff;}
.gg-link-item{border-bottom:1px solid #f0f0ee;border-right:1px solid #f0f0ee;}
.gg-link-item a{display:flex;align-items:center;gap:8px;padding:13px 20px;text-decoration:none;color:#1a1a1a;font-size:13.5px;line-height:1.4;transition:background .2s,color .2s;}
.gg-link-item a:hover{background:#f5f9f5;color:#0a280f;}
.gg-link-item a::before{content:"›";color:#C5A44E;font-size:18px;font-weight:700;flex-shrink:0;}
.gg-estado-badge{margin-left:auto;font-size:10px;font-weight:700;color:#C5A44E;background:#fff8ee;border:1px solid #C5A44E;border-radius:4px;padding:1px 6px;white-space:nowrap;flex-shrink:0;}
(function(){
function getEstado(t){t=t.toLowerCase();if(t.includes('minas gerais')||t.includes('belo horizonte'))return'MG';if(t.includes('são paulo')||t.includes('sao paulo'))return'SP';if(t.includes('rio de janeiro'))return'RJ';if(t.includes('espírito santo')||t.includes('espirito santo'))return'ES';return'';}
var cats=[{key:'gas',icon:'🔥',nome:'Gás Natural e GLP',kws:['gás natural','gas natural','glp']},{key:'eletrico',icon:'⚡',nome:'Projeto Elétrico',kws:['elétrico','eletrico']},{key:'hidra',icon:'💧',nome:'Hidráulico Residencial',kws:['hidráulico','hidraulico']},{key:'esgoto',icon:'🚿',nome:'Esgoto Residencial',kws:['esgoto','esgotamento']},{key:'drenagem',icon:'🌧️',nome:'Drenagem Pluvial',kws:['drenagem','pluvial']},{key:'licenca',icon:'📋',nome:'Licenciamento Ambiental',kws:['licenciamento','ambiental']}];
fetch('/wp-json/wp/v2/posts?per_page=100&_fields=id,title,link&orderby=title&order=asc').then(function(r){return r.json();}).then(function(posts){
var el=document.getElementById('gg-indice-artigos');if(!el)return;
var html='
Índice de Artigos
Navegue por todos os nossos conteúdos técnicos
';
var ordemE=['MG','SP','RJ','ES'];
cats.forEach(function(cat){
var matched=posts.filter(function(p){var t=(p.title.rendered||'').toLowerCase();return cat.kws.some(function(k){return t.includes(k);});});
if(!matched.length)return;
matched.sort(function(a,b){var ea=getEstado(a.title.rendered),eb=getEstado(b.title.rendered),ia=ordemE.indexOf(ea),ib=ordemE.indexOf(eb);if(ia<0)ia=99;if(ib<0)ib=99;return ia!==ib?ia-ib:(a.title.rendered||'').localeCompare(b.title.rendered||'','pt');});
html+='
';
matched.forEach(function(p){var titulo=p.title.rendered.replace(/&#[0-9]+;/g,'').replace(/&/g,'&');var estado=getEstado(titulo);html+='
';});
html+='
';});
el.innerHTML=html;el.style.opacity='1';}).catch(function(e){console.error(e);});
})();