/*
Theme Name: SCMB
Theme URI: https://www.scmbenavente.pt/
Author: Santa Casa da Misericórdia de Benavente
Description: Tema institucional da Santa Casa da Misericórdia de Benavente. Leve, acessível e adaptado a telemóvel, sem pedidos a serviços externos.
Version: 1.0.1
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: scmb
*/

:root {
	--ink: #1e2a32;
	--slate: #2f4f5f;
	--slate-dark: #213a46;
	--gold: #8a6a2f;
	--gold-soft: #c9ad78;
	--bg: #faf8f4;
	--surface: #ffffff;
	--tint: #f1ece3;
	--line: #e4ded3;
	--muted: #56616b;
	--radius: 10px;
	--wrap: 1180px;
	--serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 400 1.125rem/1.65 var(--sans);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--slate); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--slate-dark); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--gold-soft); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--slate-dark); margin: 1.6em 0 .55em; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.small { font-size: .9rem; color: var(--muted); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--slate); color: #fff; padding: .7rem 1rem; border-radius: var(--radius); }
.skip-link:focus { top: 1rem; }

/* ---------- topo */
.topbar { background: var(--slate-dark); color: #dfe7ea; font-size: .88rem; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar__inner { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; flex-wrap: wrap; }
.topbar p { margin: 0; display: flex; gap: .15rem 1.4rem; flex-wrap: wrap; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.site-header__inner { display: flex; align-items: center; gap: 1.5rem; min-height: 96px; }
.brand { flex-shrink: 0; display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand__logo { width: 78px; height: auto; mix-blend-mode: multiply; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--slate-dark); max-width: 17ch; }
.brand__tag { font-size: .85rem; color: var(--muted); margin-top: .25rem; }

.main-nav { display: flex; align-items: center; gap: 1rem; }
.main-nav .menu { list-style: none; margin: 0; padding: 0; display: flex; gap: .1rem; }
.main-nav .menu > li { position: relative; display: flex; align-items: center; }
.main-nav .menu a { display: block; padding: .6rem .6rem; text-decoration: none; color: var(--ink); font-weight: 550; font-size: 1rem; border-radius: 6px; white-space: nowrap; }
.main-nav .sub-menu a { white-space: normal; }
.main-nav .menu a:hover, .main-nav .current-menu-item > a, .main-nav .current-menu-ancestor > a, .main-nav .current_page_item > a { color: var(--slate); background: var(--tint); }
.main-nav .sub-menu { list-style: none; margin: 0; padding: .5rem; position: absolute; top: 100%; left: 0; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 30px rgba(30, 42, 50, .12); display: none; }
.main-nav .sub-menu a { font-weight: 450; }
.main-nav .menu > li:hover > .sub-menu, .main-nav .menu > li:focus-within > .sub-menu, .main-nav .menu > li.is-open > .sub-menu { display: block; }
.submenu-toggle { display: none; }
.nav-search { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.nav-search input { border: 0; background: transparent; padding: .45rem .8rem; width: 7.5rem; font: inherit; font-size: .95rem; }
@media (max-width: 1280px) and (min-width: 1081px) {
	.nav-search input { width: 0; padding: .45rem 0 .45rem .2rem; }
	.nav-search:focus-within input { width: 9rem; padding: .45rem .8rem; }
	.brand__name { font-size: 1.12rem; }
}
.nav-search button { border: 0; background: transparent; padding: 0 .75rem; color: var(--slate); cursor: pointer; }
.nav-toggle { display: none; }

@media (max-width: 1080px) {
	.nav-toggle { display: inline-flex; align-items: center; gap: .55rem; background: var(--slate); color: #fff; border: 0; border-radius: 999px; padding: .6rem 1rem; font: 600 1rem var(--sans); cursor: pointer; }
	.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; display: block; width: 18px; height: 2px; background: currentColor; position: relative; }
	.nav-toggle__bars::before { position: absolute; top: -6px; }
	.nav-toggle__bars::after { position: absolute; top: 6px; }
	.main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); padding: 1rem 1.25rem 1.5rem; flex-direction: column; align-items: stretch; box-shadow: 0 18px 30px rgba(30, 42, 50, .12); }
	.main-nav.is-open { display: flex; }
	.main-nav .menu { flex-direction: column; }
	.main-nav .menu > li { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
	.main-nav .menu > li > a { flex: 1; padding: .85rem .3rem; font-size: 1.1rem; }
	.main-nav .sub-menu { position: static; display: none; box-shadow: none; border: 0; padding: 0 0 .6rem 1rem; width: 100%; min-width: 0; }
	.main-nav .menu > li:hover > .sub-menu, .main-nav .menu > li:focus-within > .sub-menu { display: none; }
	.main-nav .menu > li.is-open > .sub-menu { display: block; }
	.submenu-toggle { display: block; width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; position: relative; }
	.submenu-toggle::after { content: ""; position: absolute; inset: 0; margin: auto; width: 10px; height: 10px; border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate); transform: translateY(-3px) rotate(45deg); transition: transform .2s; }
	.submenu-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
	.nav-search { margin-top: 1rem; }
	.nav-search input { width: 100%; }
}
@media (max-width: 560px) {
	.brand__logo { width: 58px; }
	.brand__name { font-size: 1.05rem; }
	.brand__tag { display: none; }
	.nav-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); }
	.nav-toggle { padding: .75rem .9rem; }
	.topbar { font-size: .82rem; }
	.topbar__links { display: none !important; }
}

/* ---------- destaque inicial */
.hero { background: var(--slate-dark); color: #fff; position: relative; overflow: hidden; }
.hero--image { background: linear-gradient(90deg, rgba(20, 34, 42, .92) 0%, rgba(20, 34, 42, .72) 45%, rgba(20, 34, 42, .25) 100%), var(--hero) center / cover no-repeat; }
.hero__inner { padding: clamp(3.5rem, 8vw, 6.5rem) 0; max-width: var(--wrap); }
.hero__eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .8rem; color: var(--gold-soft); margin: 0 0 .8rem; font-weight: 600; }
.hero__title { color: #fff; margin: 0 0 1rem; max-width: 16ch; }
.hero__text { max-width: 52ch; font-size: 1.2rem; color: #e8eef0; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.6rem 0 0; }

.btn, .wp-element-button, .search-form button { display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.3rem; border-radius: 999px; font: 600 1rem var(--sans); text-decoration: none; border: 2px solid var(--slate); background: var(--slate); color: #fff; cursor: pointer; }
.btn:hover, .wp-element-button:hover { background: var(--slate-dark); border-color: var(--slate-dark); color: #fff; }
.btn--light { background: #fff; border-color: #fff; color: var(--slate-dark); }
.btn--light:hover { background: var(--tint); border-color: var(--tint); color: var(--slate-dark); }
.btn--ghost { background: transparent; border-color: rgba(255, 255, 255, .7); color: #fff; }
.btn--ghost:hover { background: rgba(255, 255, 255, .12); border-color: #fff; }

.notice-band { background: var(--tint); border-bottom: 1px solid var(--line); }
.notice-band__inner { display: flex; align-items: center; gap: 1rem; padding: .9rem 0; }
.notice-band p { margin: 0; font-weight: 600; }
.notice-band__tag, .tag { display: inline-block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--gold); border: 1px solid var(--gold-soft); border-radius: 999px; padding: .2rem .65rem; text-decoration: none; white-space: nowrap; }

/* ---------- secções */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section--tint { background: var(--tint); }
.section__title { margin-top: 0; position: relative; padding-bottom: .6rem; }
.section__title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 48px; height: 3px; background: var(--gold-soft); border-radius: 2px; }
.more { font-weight: 600; text-decoration: none; }
.more::after { content: " →"; }

.areas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.area { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.area__media { display: block; aspect-ratio: 16 / 9; background: var(--tint); }
.area__media img { width: 100%; height: 100%; object-fit: cover; }
.area__body { padding: 1.3rem 1.4rem 1.5rem; }
.area__title { margin: 0 0 .5rem; }
.area__title a { text-decoration: none; color: var(--slate-dark); }
.area__body p { color: var(--muted); font-size: 1rem; }
.area__links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.area__links a { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: 1rem; font-weight: 500; }
.area__links a::after { content: "›"; float: right; color: var(--gold); }
@media (max-width: 900px) { .areas { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.phones { list-style: none; margin: 0 0 1rem; padding: 0; }
.phones li { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.phones__service { font-weight: 600; }
.phones__number { font-size: 1.15rem; font-weight: 700; text-decoration: none; white-space: nowrap; grid-row: span 2; align-self: center; }
.phones__opt { font-size: .85rem; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.card__media { display: block; aspect-ratio: 16 / 10; background: var(--tint); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media--empty { background: linear-gradient(135deg, var(--tint), #e7dfd1); }
.card__body { padding: 1.1rem 1.25rem 1.4rem; }
.card__date { font-size: .85rem; color: var(--muted); margin: 0 0 .3rem; }
.card__title { font-size: 1.15rem; margin: 0 0 .5rem; }
.card__title a { text-decoration: none; color: var(--slate-dark); }
.card__title a:hover { text-decoration: underline; }
.card__excerpt { font-size: .98rem; color: var(--muted); margin: 0; }

/* ---------- páginas */
.page-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 1.6rem 0 2rem; }
.page-title { margin: .4rem 0 0; }
.page-intro { color: var(--muted); max-width: 65ch; margin-top: .6rem; }
.entry-meta { display: flex; gap: 1rem; align-items: center; margin: .8rem 0 0; color: var(--muted); font-size: .95rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: .3rem; color: var(--line); }
.crumbs a { color: var(--muted); }

.layout { padding: clamp(2rem, 5vw, 3.5rem) 0 4rem; }
.layout--nav { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
.layout__main { max-width: 760px; }
.section-nav { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; position: sticky; top: 1rem; }
.section-nav__title { margin: 0 0 .4rem; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.section-nav__title a { text-decoration: none; color: var(--slate-dark); }
.section-nav ul { list-style: none; margin: 0; padding: 0; }
.section-nav li a { display: block; padding: .45rem .6rem; border-radius: 6px; text-decoration: none; font-size: 1rem; }
.section-nav li a:hover { background: var(--tint); }
.section-nav li a[aria-current] { background: var(--slate); color: #fff; }
@media (max-width: 900px) {
	.layout--nav { grid-template-columns: 1fr; }
	.layout__aside { order: 2; }
	.section-nav { position: static; }
}

.entry-content > *:first-child { margin-top: 0; }
.entry-content h2 { padding-top: .2rem; }
.entry-content h3 { font-size: 1.15rem; font-family: var(--sans); font-weight: 700; letter-spacing: .02em; color: var(--slate); margin-top: 1.6em; }
.entry-content ul, .entry-content ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.entry-content li { margin-bottom: .3em; }
.entry-content figure { margin: 1.5rem 0; }
.entry-content img { border-radius: var(--radius); }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; background: var(--surface); }
.entry-content th, .entry-content td { text-align: left; vertical-align: top; padding: .75rem .8rem; border-bottom: 1px solid var(--line); }
.entry-content th { background: var(--tint); font-weight: 700; }
.entry-content .wp-block-table td, .entry-content .wp-block-table th { border: 0; border-bottom: 1px solid var(--line); }
.entry-content .wp-block-table thead { border-bottom: 2px solid var(--gold-soft); }
.entry-content .wp-block-table table { border: 1px solid var(--line); border-radius: var(--radius); }
.entry-content td a[href^="tel:"] { white-space: nowrap; font-weight: 600; }
.entry-content .scmb-docs__filtros ul, .entry-content .scmb-docs__lista { padding-left: 0; }
.entry-content .scmb-doc { margin-bottom: 0; }
.entry-content a[href$=".pdf"]:not(.scmb-doc__title)::before { content: "PDF"; font-size: .65rem; font-weight: 700; letter-spacing: .05em; border: 1px solid currentColor; border-radius: 3px; padding: .05rem .3rem; margin-right: .45rem; vertical-align: .15em; }
@media (max-width: 640px) {
	.entry-content table, .entry-content thead, .entry-content tbody, .entry-content tr, .entry-content td, .entry-content th { display: block; }
	.entry-content thead { display: none; }
	.entry-content tr { border-bottom: 1px solid var(--line); padding: .5rem 0; }
	.entry-content td { border: 0; padding: .2rem .8rem; }
}
.post-navigation { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.post-navigation .nav-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.post-navigation .nav-next { text-align: right; }
.nav-label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pagination .nav-links { display: flex; gap: .4rem; flex-wrap: wrap; }
.pagination .page-numbers { padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; background: var(--surface); }
.pagination .current { background: var(--slate); color: #fff; border-color: var(--slate); }

/* ---------- documentos (complementa o plugin) */
.scmb-docs__ano h2 { font-size: 1.4rem; margin: 2rem 0 .4rem; }
.scmb-doc__icon { color: var(--slate); background: var(--surface); }
.scmb-doc__title { color: var(--slate-dark); }
.scmb-doc__type { color: var(--gold); font-weight: 600; }
.scmb-docs__filtros a { color: var(--slate); background: var(--surface); }
.section--tint .scmb-doc { border-color: #ddd4c4; }
.scmb-doc-download { margin-top: 2rem; display: flex; align-items: center; gap: 1rem; }

/* ---------- pesquisa */
.search-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; max-width: 640px; }
.search-form input { flex: 1; min-width: 220px; padding: .75rem 1rem; border: 1px solid #cfc7b8; border-radius: 999px; font: inherit; }
.results { list-style: none; padding: 0; margin: 0; max-width: 800px; }
.results__item { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.results__title { display: block; font-size: 1.15rem; font-weight: 600; margin: .35rem 0; }
.results p { margin: 0; color: var(--muted); font-size: 1rem; }

/* ---------- rodapé */
.site-footer { background: var(--slate-dark); color: #d7e0e4; font-size: 1rem; }
.site-footer a { color: #fff; }
.site-footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 2.5rem; padding: 3.5rem 0 2.5rem; }
.site-footer .brand__logo { width: 64px; filter: invert(1) grayscale(1); mix-blend-mode: screen; margin-bottom: .8rem; }
.site-footer__name { font-family: var(--serif); font-size: 1.2rem; color: #fff; margin: 0 0 .2rem; }
.site-footer__title { font-family: var(--sans); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--gold-soft); margin: 0 0 .8rem; }
.site-footer address { font-style: normal; margin-bottom: .6rem; }
.site-footer .small { color: #aebdc4; }
.footer-links { list-style: none; margin: 0 0 1rem; padding: 0; }
.footer-links li { margin-bottom: .35rem; }
.complaints { display: inline-block; border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; padding: .45rem .8rem; text-decoration: none; font-weight: 600; }
.site-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .14); padding: 1.1rem 0 1.4rem; font-size: .88rem; color: #aebdc4; }
.site-footer__bottom p { margin: 0; }
@media (max-width: 800px) { .site-footer__grid { grid-template-columns: 1fr; gap: 1.8rem; } }

/* ---------- impressão */
@media print {
	.topbar, .site-header nav, .nav-toggle, .site-footer, .section-nav, .post-navigation { display: none !important; }
	body { background: #fff; font-size: 11pt; }
	.page-head { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
