/*
Theme Name: CEBES
Theme URI: https://cebes.com.br
Author: cebes.com.br
Description: Tema otimizado (mobile-first, velocidade, segurança e SEO) para o cebes.com.br. Lê os dados das tabelas CNES a partir da meta key co_cnes.
Version: 1.0.0
*/

/* ============================================================
   CEBES — design tokens
   Paleta: verde clínico profundo + areia clara + âmbar de acento.
   Tipografia: Fraunces (display) + Public Sans (texto).
   ============================================================ */
:root {
	--c-ink: #15241f;
	--c-body: #2c3a35;
	--c-muted: #5c6b65;
	--c-line: #e8eae7;
	--c-bg: #ffffff;
	--c-card: #ffffff;
	--c-soft: #f4f6f5;
	--c-green: #11705a;
	--c-green-deep: #0c4f40;
	--c-green-soft: #e7f1ed;
	--c-amber: #c9882b;
	--c-amber-soft: #f7edd8;
	--radius: 14px;
	--radius-sm: 9px;
	--shadow: 0 1px 2px rgba(16, 40, 33, .06), 0 8px 24px -12px rgba(16, 40, 33, .18);
	--maxw: 1080px;
	--ff-display: "Fraunces", Georgia, "Times New Roman", serif;
	--ff-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- reset enxuto ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--ff-body);
	font-size: 17px;
	line-height: 1.65;
	color: var(--c-body);
	background: var(--c-bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-green); text-decoration: none; }
a:hover { color: var(--c-green-deep); text-decoration: underline; }

h1, h2, h3 { font-family: var(--ff-display); color: var(--c-ink); line-height: 1.2; font-weight: 600; }
h2 { font-size: 1.45rem; margin: 1.8em 0 .6em; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 .5em; }
p { margin: 0 0 1em; }

.cebes-container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.cebes-sr {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap;
}
.cebes-skip {
	position: absolute; left: -999px; top: 0; background: var(--c-green); color: #fff;
	padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.cebes-skip:focus { left: 0; }

/* ============================================================
   Header
   ============================================================ */
.cebes-header {
	background: var(--c-card);
	border-bottom: 1px solid var(--c-line);
	position: sticky; top: 0; z-index: 40;
}
.cebes-header-inner {
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
	padding-top: 12px; padding-bottom: 12px;
}
.cebes-logo-mark { margin: 0; font-size: 0; line-height: 0; }
.cebes-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.cebes-brand:hover { text-decoration: none; }
.cebes-brand-mark {
	display: grid; place-content: center; width: 38px; height: 38px; flex: 0 0 auto;
	border-radius: 10px; background: var(--c-green); color: #fff;
}
.cebes-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.cebes-brand-name {
	font-family: var(--ff-display); font-weight: 600; font-size: 1.5rem;
	color: var(--c-green-deep); letter-spacing: -.01em;
}
.cebes-brand-tag { font-size: .72rem; color: var(--c-muted); letter-spacing: .02em; }

.cebes-nav-toggle {
	margin-left: auto; width: 44px; height: 44px; border: 1px solid var(--c-line);
	border-radius: var(--radius-sm); background: var(--c-soft); display: grid; gap: 4px;
	place-content: center; cursor: pointer;
}
.cebes-nav-toggle span { display: block; width: 20px; height: 2px; background: var(--c-ink); border-radius: 2px; }

.cebes-tools { display: none; width: 100%; flex-direction: column; gap: 10px; padding-top: 6px; }
.cebes-tools.is-open { display: flex; }
.cebes-filters { display: flex; flex-wrap: wrap; gap: 10px; }
.cebes-filters select { flex: 1 1 160px; }

/* selects e inputs */
select, input[type="search"], input[type="text"] {
	width: 100%; font: inherit; color: var(--c-ink);
	background: var(--c-card); border: 1px solid var(--c-line);
	border-radius: var(--radius-sm); padding: 11px 12px; appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2311705a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input::placeholder { color: var(--c-muted); opacity: 1; }
:focus-visible { outline: 3px solid rgba(17,112,90,.35); outline-offset: 1px; }

/* dropdowns clean do header (especialidade / tipo de unidade) */
.cebes-jump {
	background-color: transparent;
	border-color: var(--c-line);
	color: var(--c-muted);
	font-size: .95rem;
}
.cebes-jump:hover { border-color: var(--c-green); color: var(--c-ink); }
.cebes-jump:focus { color: var(--c-ink); }

/* botões */
.cebes-btn {
	display: inline-block; font: inherit; font-weight: 700; cursor: pointer;
	background: var(--c-green); color: #fff; border: 0; border-radius: var(--radius-sm);
	padding: 11px 20px; transition: background .15s ease;
}
.cebes-btn:hover { background: var(--c-green-deep); color: #fff; text-decoration: none; }
.cebes-btn .ci { color: #fff; }
.cebes-btn-ghost {
	background: var(--c-card); color: var(--c-green-deep); border: 1px solid var(--c-green);
}
.cebes-btn-ghost:hover { background: var(--c-green-soft); color: var(--c-green-deep); }
.cebes-btn-ghost .ci { color: var(--c-green); }

/* busca header */
.cebes-search { position: relative; display: flex; gap: 8px; }
.cebes-search input { flex: 1; }
.cebes-search-results {
	position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
	background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-sm);
	box-shadow: var(--shadow); max-height: 60vh; overflow: auto;
}
.cebes-ajax-results { list-style: none; margin: 0; padding: 6px; }
.cebes-ajax-results li a { display: block; padding: 9px 10px; border-radius: 7px; color: var(--c-ink); }
.cebes-ajax-results li a:hover { background: var(--c-green-soft); text-decoration: none; }
.cebes-ajax-meta { padding: 8px 12px; border-top: 1px solid var(--c-line); font-size: .9rem; }
.cebes-search-results .no-results { padding: 12px; color: var(--c-muted); }

/* ============================================================
   Main / layout
   ============================================================ */
.cebes-main { padding: 22px 0 40px; }
.cebes-breadcrumb { font-size: .86rem; color: var(--c-muted); margin-bottom: 16px; }
.cebes-breadcrumb a { color: var(--c-muted); }
.cebes-breadcrumb a:hover { color: var(--c-green); }

/* form busca unidade — clean (somente na home) */
.cebes-busca {
	background: var(--c-card);
	border: 1px solid var(--c-line);
	border-radius: var(--radius); padding: 20px 22px; margin-bottom: 26px;
	box-shadow: var(--shadow);
}
.cebes-busca-title {
	color: var(--c-ink); margin: 0 0 2px; font-size: 1.15rem; letter-spacing: -.01em;
	font-family: var(--ff-display); font-weight: 600;
}
.cebes-busca-sub { color: var(--c-muted); margin: 0 0 16px; font-size: .92rem; }
.cebes-loc-form { display: grid; gap: 12px; grid-template-columns: 1fr; }
.cebes-loc-field label { display: block; font-size: .78rem; font-weight: 700; margin-bottom: 5px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .03em; }
.cebes-loc-submit { display: flex; align-items: end; }
.cebes-loc-submit .cebes-btn { width: 100%; }

/* títulos de página */
.cebes-title { font-size: 1.7rem; margin: 0 0 4px; letter-spacing: -.015em; }
.cebes-article-head, .cebes-archive-head { margin-bottom: 8px; }
.cebes-head-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.cebes-chip {
	display: inline-flex; align-items: center; gap: 6px; font-size: .85rem;
	background: var(--c-green-soft); color: var(--c-green-deep);
	padding: 5px 11px; border-radius: 999px;
}
.cebes-chip a { color: var(--c-green-deep); }
.cebes-chip-mais { color: var(--c-muted); font-size: .8rem; font-style: italic; }

/* corpo de conteúdo */
.cebes-entry { color: var(--c-body); }
.cebes-entry a { text-decoration: underline; text-underline-offset: 2px; }

/* listas de ícone */
.cebes-iconlist { list-style: none; margin: 1em 0; padding: 0; display: grid; gap: 8px; }
.cebes-iconlist li {
	background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius-sm);
	padding: 11px 14px; padding-left: 40px; position: relative;
}
.cebes-iconlist li strong { color: var(--c-ink); }

/* tags / serviços */
.cebes-tags { list-style: none; margin: 1em 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cebes-tags li {
	background: var(--c-green-soft); color: var(--c-green-deep);
	padding: 6px 12px; border-radius: 999px; font-size: .9rem;
}

/* tabelas */
.cebes-table { width: 100%; border-collapse: collapse; margin: 1em 0; background: var(--c-card); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--c-line); }
.cebes-table th { background: var(--c-green); color: #fff; text-align: left; font-family: var(--ff-body); font-weight: 700; padding: 10px 14px; font-size: .92rem; }
.cebes-table td { padding: 10px 14px; border-top: 1px solid var(--c-line); }
.cebes-table tbody tr:nth-child(even) td { background: var(--c-soft); }
.cebes-table tfoot td { font-size: .8rem; color: var(--c-muted); }

/* relacionados / termos */
.cebes-related, .cebes-termlist { list-style: none; margin: 1em 0; padding: 0; display: grid; gap: 6px; grid-template-columns: 1fr; }
.cebes-related li, .cebes-termlist li { padding-left: 26px; position: relative; }
.cebes-map {
	margin: 14px 0; border-radius: var(--radius); overflow: hidden;
	border: 1px solid var(--c-line); box-shadow: var(--shadow); background: var(--c-soft);
	aspect-ratio: 16 / 9;
}
.cebes-map iframe { width: 100%; height: 100%; border: 0; display: block; }
.cebes-map-link { margin: 12px 0; }
.cebes-map-link .cebes-btn { display: inline-flex; align-items: center; gap: 8px; }

/* ============================================================
   Home — blocos e listas em pílula
   ============================================================ */
.cebes-home-block { margin: 26px 0; }
.cebes-home-title {
	font-size: 1.3rem; margin: 0 0 12px; padding-bottom: 8px;
	border-bottom: 2px solid var(--c-green-soft);
}
.cebes-pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cebes-pill-list a {
	display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
	background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 999px;
	color: var(--c-ink); font-size: .92rem; text-decoration: none; transition: all .15s ease;
}
.cebes-pill-list a:hover { background: var(--c-green-soft); border-color: var(--c-green); color: var(--c-green-deep); }
.cebes-pill-count {
	font-size: .76rem; font-weight: 700; color: var(--c-green-deep);
	background: #fff; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--c-line);
}

/* ============================================================
   Cards de arquivo
   ============================================================ */
.cebes-cards { display: grid; gap: 14px; margin: 18px 0; grid-template-columns: 1fr; }
.cebes-card {
	background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
	padding: 16px 18px; box-shadow: var(--shadow);
	border-left: 4px solid var(--c-green);
}
.cebes-card-title { font-size: 1.1rem; margin: 0 0 8px; line-height: 1.3; }
.cebes-card-title a { color: var(--c-ink); }
.cebes-card-title a:hover { color: var(--c-green); }
.cebes-card-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.cebes-card-meta li { display: flex; align-items: flex-start; gap: 7px; font-size: .9rem; color: var(--c-muted); line-height: 1.45; }
.cebes-card-meta li .ci { flex: 0 0 auto; margin: 0; margin-top: .12em; vertical-align: middle; }
.cebes-card-meta a { color: var(--c-green-deep); }
.cebes-card-meta a:hover { color: var(--c-green); }
.cebes-empty { background: var(--c-card); border: 1px dashed var(--c-line); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--c-muted); }

/* paginação */
.cebes-pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 22px 0; justify-content: center; }
.cebes-pagination a, .cebes-pagination span {
	display: inline-block; min-width: 40px; text-align: center; padding: 9px 12px;
	border: 1px solid var(--c-line); border-radius: var(--radius-sm); background: var(--c-card); color: var(--c-ink);
}
.cebes-pagination .current { background: var(--c-green); color: #fff; border-color: var(--c-green); }
.cebes-pagination a:hover { background: var(--c-green-soft); text-decoration: none; }

/* ============================================================
   Footer
   ============================================================ */
.cebes-footer { background: var(--c-ink); color: #c8d3ce; padding: 28px 0; margin-top: 30px; }
.cebes-footer a { color: #9fd3c4; }
.cebes-copy { font-size: .86rem; margin: 0; line-height: 1.6; }
.cebes-termlist a { color: #9fd3c4; }

/* nota de fallback na busca sem resultados */
.cebes-fallback-note {
	background: var(--c-soft); border: 1px solid var(--c-line); border-left: 4px solid var(--c-amber);
	border-radius: var(--radius-sm); padding: 12px 16px; margin: 6px 0 4px; color: var(--c-body);
}

/* ============================================================
   Página de busca densa (/saude/{palavra}/)
   ============================================================ */
.cebes-search-hero { margin: 6px 0 10px; }
.cebes-search-lead { font-size: 1.02rem; color: var(--c-body); margin: 8px 0 0; }
.cebes-section { margin: 26px 0; }
.cebes-h2 {
	font-size: 1.3rem; margin: 0 0 14px; padding-bottom: 8px;
	border-bottom: 2px solid var(--c-green-soft);
}
.cebes-muted { color: var(--c-muted); margin: 0 0 14px; }

/* box editorial intercalado nos resultados */
.cebes-box-saude {
	grid-column: 1 / -1;
	background: var(--c-green-soft); border: 1px solid var(--c-line); border-left: 4px solid var(--c-green);
	border-radius: var(--radius); padding: 16px 18px;
}
.cebes-box-saude h3 { margin: 0 0 6px; color: var(--c-green-deep); font-size: 1.05rem; }
.cebes-box-saude p { margin: 0; color: var(--c-body); font-size: .95rem; }

/* grades de informação (tipos de unidade / serviços) */
.cebes-grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.cebes-info-card {
	background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--radius);
	padding: 16px 18px; box-shadow: var(--shadow);
}
.cebes-info-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.cebes-info-card h3 a { color: var(--c-ink); }
.cebes-info-card h3 a:hover { color: var(--c-green); }
.cebes-info-card p { margin: 0; font-size: .94rem; color: var(--c-body); }

/* termos populares no footer (eCart Termos) */
.cebes-termos { margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.cebes-termos-title { font-size: 1rem; margin: 0 0 12px; color: #eaf3ef; font-family: var(--ff-body); font-weight: 700; }
.cebes-termos-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.cebes-termos-list a {
	display: inline-block; padding: 5px 11px; font-size: .82rem; line-height: 1.3;
	background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
	border-radius: 999px; color: #c8d3ce; text-decoration: none;
}
.cebes-termos-list a:hover { background: rgba(159,211,196,.18); color: #fff; }

/* ============================================================
   Ícones (SVG mask, sem font externa)
   ============================================================ */
.ci { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.16em; margin-right: .35em;
	background-color: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; color: var(--c-green); }
.cebes-iconlist li .ci { position: absolute; left: 14px; top: 13px; }
.cebes-related li .ci, .cebes-termlist li .ci { position: absolute; left: 0; top: 4px; }
.ci-pin { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a7 7 0 0 0-7 7c0 5 7 13 7 13s7-8 7-13a7 7 0 0 0-7-7zm0 9.5A2.5 2.5 0 1 1 12 6.5a2.5 2.5 0 0 1 0 5z'/%3E%3C/svg%3E"); }
.ci-medkit { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 3h6a1 1 0 0 1 1 1v2h3a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3V4a1 1 0 0 1 1-1zm1 3h4V5h-4v1zm3 5h-2v2H9v2h2v2h2v-2h2v-2h-2v-2z'/%3E%3C/svg%3E"); }
.ci-esp { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 8a2 2 0 1 0-2-2 2 2 0 0 0 2 2zM7 4a3 3 0 0 0-1 5.83V13a4 4 0 0 0 8 0v-1.07A3 3 0 0 1 17 9v.17A4 4 0 1 1 12 15v-1.13A5 5 0 0 1 8 9V9.83A3 3 0 0 0 7 4z'/%3E%3C/svg%3E"); }
.ci-tel { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.6 10.8a15.5 15.5 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.58 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1 11.4 11.4 0 0 0 .58 3.6 1 1 0 0 1-.25 1z'/%3E%3C/svg%3E"); }
.ci-clock { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm1 11h-4v-2h2V7h2z'/%3E%3C/svg%3E"); }
.ci-check { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E"); }
.ci-cnes, .ci-tipo { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h16v4H4zm0 6h16v4H4zm0 6h10v4H4z'/%3E%3C/svg%3E"); }
.ci-estabelecimento { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 21V8l9-5 9 5v13h-6v-6h-6v6z'/%3E%3C/svg%3E"); }
.ci-razao { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4 4 0 1 0-4-4 4 4 0 0 0 4 4zm0 2c-4 0-8 2-8 5v1h16v-1c0-3-4-5-8-5z'/%3E%3C/svg%3E"); }
.ci-cep { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm0 4-8 5-8-5V6l8 5 8-5z'/%3E%3C/svg%3E"); }
.ci-link { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3.9 12a3 3 0 0 1 3-3h4V7h-4a5 5 0 0 0 0 10h4v-2h-4a3 3 0 0 1-3-3zm5 1h6v-2H9zm8-6h-4v2h4a3 3 0 0 1 0 6h-4v2h4a5 5 0 0 0 0-10z'/%3E%3C/svg%3E"); }

/* ============================================================
   Responsivo — escala para tablet/desktop (mobile-first)
   ============================================================ */
@media (min-width: 640px) {
	.cebes-loc-form { grid-template-columns: 1fr 1fr; }
	.cebes-loc-submit { grid-column: 1 / -1; }
	.cebes-iconlist { grid-template-columns: 1fr 1fr; }
	.cebes-related, .cebes-termlist { grid-template-columns: 1fr 1fr; }
	.cebes-grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
	.cebes-nav-toggle { display: none; }
	.cebes-tools { display: flex; flex-direction: row; align-items: center; width: auto; margin-left: auto; padding-top: 0; flex-wrap: wrap; gap: 10px; }
	.cebes-search { width: 380px; }
	.cebes-search input { min-width: 0; }
	.cebes-filters { flex-wrap: nowrap; }
	.cebes-filters select { width: 180px; flex: 0 0 auto; }
	.cebes-loc-form { grid-template-columns: 1fr 1fr 1fr auto; }
	.cebes-loc-submit { grid-column: auto; }
	.cebes-loc-submit .cebes-btn { width: auto; }
	.cebes-cards { grid-template-columns: 1fr 1fr; }
	.cebes-title { font-size: 2rem; }
	.cebes-related, .cebes-termlist { grid-template-columns: 1fr 1fr 1fr; }
}
