/*
Theme Name: Engemec
Description: Tema leve e editável da Engemec (blocos nativos, sem construtor de páginas).
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.0
Text Domain: engemec
*/

:root {
	--navy: var(--wp--preset--color--navy);
	--primary: var(--wp--preset--color--primary);
	--accent: var(--wp--preset--color--accent);
	--light: var(--wp--preset--color--light);
	--border: var(--wp--preset--color--border);
	--muted: var(--wp--preset--color--muted);
	--radius: 8px;
	--shadow: 0 8px 24px rgba(10, 31, 61, .08);
	--edge: max(20px, calc((100vw - 1180px) / 2));
}

html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 84px; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wp-site-blocks > * + *, .wp-block-post-content > .alignfull { margin-block-start: 0; margin-block-end: 0; }
mark { background: none !important; color: var(--accent); }

/* ---------- Cabeçalho ---------- */
header.wp-block-template-part { position: sticky; top: 0; z-index: 50; background: #fff; box-shadow: 0 1px 0 var(--border); }
.eg-header__inner { min-height: 68px; gap: 24px; }
.eg-brand .wp-block-site-title { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; }
.eg-brand .wp-block-site-title a { color: var(--navy); text-decoration: none; }
.eg-brand:has(.wp-block-site-logo img) .wp-block-site-title { display: none; }
.eg-nav { font-size: .92rem; font-weight: 500; gap: 28px; }
.eg-nav a { text-decoration: none; padding-block: 22px; }
.eg-nav .current-menu-item > a, .eg-nav a[aria-current="page"] { color: var(--primary); box-shadow: inset 0 -2px 0 var(--primary); }
.eg-header__actions { gap: 18px; }
.eg-header__actions p { margin: 0; }
.eg-client { display: inline-flex; gap: 6px; align-items: center; color: var(--navy); font-size: .9rem; text-decoration: none; }
.eg-btn-sm .wp-block-button__link { padding: .6em 1.1em; }
@media (max-width: 781px) {
	.eg-header__actions .eg-client { display: none; }
	.eg-nav .wp-block-navigation__responsive-container.is-menu-open { padding: 24px; }
	.eg-nav .wp-block-navigation__responsive-container.is-menu-open a { padding-block: 8px; font-size: 1.2rem; }
}

/* ---------- Seções ---------- */
.eg-section { padding-block: clamp(48px, 7vw, 88px); }
.eg-section--light { background: var(--light); }
.eg-section--navy { background: var(--navy); color: #fff; }
.eg-section--navy :is(h1, h2, h3) { color: #fff; }
.eg-section--navy .eg-lead { color: #c9d5e8; }
.eg-eyebrow { margin-bottom: 0 !important; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.eg-eyebrow::after { content: ""; display: block; width: 32px; height: 3px; margin-top: 10px; background: var(--primary); }
.eg-lead { color: var(--muted); font-size: 1.05rem; }
.eg-note { font-size: .85rem; color: var(--muted); }
.eg-center { text-align: center; }
.eg-center .eg-lead { margin-inline: auto; }

/* ---------- Hero ---------- */
.eg-hero { background: linear-gradient(100deg, #071730 0%, var(--navy) 55%, #0d2b55 100%); color: #fff; overflow: hidden; }
.eg-hero > .wp-block-columns { gap: 0; margin: 0; align-items: stretch; }
.eg-hero__text { padding: clamp(48px, 7vw, 96px) 32px clamp(48px, 7vw, 96px) var(--edge); align-self: center; }
.eg-hero h1 { color: #fff; }
.eg-hero p { color: #d7e1f0; font-size: 1.1rem; max-width: 46ch; }
.eg-hero .eg-eyebrow { color: #9cc2ff; }
.eg-hero .eg-eyebrow::after { background: var(--accent); }
.eg-hero__media { position: relative; min-height: 320px; }
.eg-hero__media figure { position: absolute; inset: 0; margin: 0; }
.eg-hero__media img { width: 100%; height: 100%; object-fit: cover; -webkit-mask-image: linear-gradient(to right, transparent, #000 35%); mask-image: linear-gradient(to right, transparent, #000 35%); }
.is-style-outline .wp-block-button__link, .wp-block-button.is-style-outline > .wp-block-button__link { background: transparent; border: 1.5px solid currentColor; color: inherit; padding: calc(.85em - 1.5px) calc(1.4em - 1.5px); }
.eg-hero .is-style-outline .wp-block-button__link, .eg-section--navy .is-style-outline .wp-block-button__link { color: #fff; }
.wp-block-button.is-style-outline .wp-block-button__link:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 781px) {
	.eg-hero__text { padding: 40px 20px 48px; }
	.eg-hero__media { order: -1; min-height: 220px; }
	.eg-hero__media img { -webkit-mask-image: linear-gradient(to top, transparent, #000 40%); mask-image: linear-gradient(to top, transparent, #000 40%); }
}

/* ---------- Grades e cartões ---------- */
.wp-block-columns.eg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.wp-block-columns.eg-grid:has(> .eg-feature) { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.wp-block-columns.eg-grid--2.eg-grid:has(> .eg-feature) { grid-template-columns: repeat(2, 1fr); }
.eg-section .wp-block-column > .wp-block-image img { width: 100%; }
.wp-block-columns.eg-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.eg-grid > .wp-block-column { margin: 0; }
.eg-card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .2s, box-shadow .2s; }
.eg-card > * { margin: 0 20px; }
.eg-card > *:last-child { margin-bottom: 20px; }
.eg-card > :is(.wp-block-image, .wp-block-post-featured-image) { margin: 0 0 16px; }
.eg-card > .wp-block-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.eg-card h3 { margin-top: 0; margin-bottom: 6px; }
.eg-card p { margin-top: 0; font-size: .92rem; color: var(--muted); }
.eg-card h3 a { color: inherit; text-decoration: none; }
.eg-card h3 a::after { content: ""; position: absolute; inset: 0; }
.eg-card:has(a):hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.eg-grid--2 .eg-card > .wp-block-image img { aspect-ratio: 3.4 / 1; }
.eg-steps + .wp-block-heading { margin-top: clamp(48px, 6vw, 72px); }
.eg-card--label > .wp-block-image { margin-bottom: 14px; }
.eg-card--label h3 { display: flex; justify-content: space-between; align-items: center; font-size: 1rem; }
.eg-card--label h3::after { content: "→"; color: var(--primary); }

/* Cartão escuro com imagem de fundo (Início) */
.eg-card--overlay { min-height: 300px; justify-content: flex-end; color: #fff; border: 0; background: var(--navy); }
.eg-card--overlay > .wp-block-image { position: absolute; inset: 0; margin: 0; }
.eg-card--overlay > .wp-block-image img { height: 100%; aspect-ratio: auto; }
.eg-card--overlay::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(7, 23, 48, .95) 20%, rgba(7, 23, 48, .2)); }
.eg-card--overlay > :not(.wp-block-image) { position: relative; z-index: 2; }
.eg-card--overlay h3 { color: #fff; font-size: 1.5rem; }
.eg-card--overlay p { color: #d7e1f0; max-width: 34ch; }
.eg-card--overlay h3 a::after { z-index: 3; }
.eg-more { font-weight: 700; color: var(--accent) !important; font-size: .9rem !important; }

/* ---------- Ícones (classe ic-*) ---------- */
.eg-feature::before, .eg-row::before { content: ""; display: block; flex: none; background: var(--primary); -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.eg-feature { padding: 24px 20px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.eg-feature::before { width: 40px; height: 40px; margin-bottom: 14px; }
.eg-feature h3 { margin: 0 0 4px; }
.eg-feature p { margin: 0; font-size: .9rem; color: var(--muted); }
.eg-center .eg-feature::before { margin-inline: auto; }
.eg-plain .eg-feature { background: none; border: 0; padding: 0; }
.eg-row { position: relative; padding-left: 34px; }
.eg-row::before { position: absolute; left: 0; top: 1px; width: 22px; height: 22px; }
.eg-section--navy .eg-row::before, .eg-footer .eg-row::before { background: var(--accent); }

/* Passos */
.eg-steps { counter-reset: step; }
.eg-steps > .wp-block-column { position: relative; }
.eg-steps--arrows > .wp-block-column:not(:last-child)::after { content: "→"; position: absolute; right: -16px; top: 28px; color: #9fb2cc; font-size: 1.4rem; }
.eg-steps--num > .wp-block-column { padding-top: 64px; }
.eg-steps--num > .wp-block-column::before { counter-increment: step; content: "0" counter(step); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #e6efff; color: var(--primary); font-weight: 800; }
.eg-steps h3 { margin: 0 0 4px; font-size: 1rem; }
.eg-steps p { margin: 0; font-size: .88rem; color: var(--muted); }
@media (max-width: 781px) { .eg-steps--arrows > .wp-block-column::after { display: none; } }

/* Números */
.eg-stat { font-size: 2.2rem !important; font-weight: 800; color: var(--navy); line-height: 1; margin: 0 !important; }
.eg-stat + p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
.eg-divided > .wp-block-column + .wp-block-column { border-left: 1px solid var(--border); padding-left: 32px; }
@media (max-width: 781px) { .eg-divided > .wp-block-column + .wp-block-column { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 24px; } }

/* Etiquetas */
.eg-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.eg-chips li { padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: .85rem; color: var(--navy); }
.eg-section--navy .eg-chips li { background: transparent; border-color: #3a5378; color: #fff; }

.eg-rounded img, .eg-rounded { border-radius: var(--radius); }
.eg-shadow img { box-shadow: var(--shadow); }

/* ---------- Contato ---------- */
.eg-contact .eg-form { padding: clamp(20px, 3vw, 32px); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--wp--preset--color--text); }
.eg-contact a { color: inherit; }
.fluentform .ff-btn-submit { background: var(--primary) !important; border-radius: 6px !important; font-weight: 700; padding: 12px 24px; width: 100%; }
.fluentform .ff-el-input--label label { font-size: .88rem; font-weight: 600; }
.fluentform .ff-el-form-control { border-radius: 6px; }

/* ---------- Blog ---------- */
.eg-posts .wp-block-post-featured-image img { aspect-ratio: 16 / 9; object-fit: cover; }
.eg-posts .wp-block-post-title { font-size: 1.05rem; }
.eg-posts .wp-block-post-title a { text-decoration: none; color: var(--navy); }
.eg-posts .wp-block-post-date { font-size: .8rem; color: var(--muted); }

/* ---------- Rodapé ---------- */
.eg-footer { background: #071730; color: #c9d5e8; font-size: .9rem; padding-block: 56px 24px; }
.eg-footer h3, .eg-footer .wp-block-site-title a { color: #fff; }
.eg-footer .wp-block-site-title { font-size: 1.6rem; font-weight: 800; text-transform: uppercase; margin: 0; }
.eg-footer .wp-block-site-title a { text-decoration: none; }
.eg-footer a { color: #fff; }
.eg-footer .wp-block-navigation a { text-decoration: none; }
.eg-footer iframe { width: 100%; height: 200px; border: 0; border-radius: var(--radius); }
.eg-footer__copy { margin-top: 40px !important; padding-top: 20px; border-top: 1px solid #1d3355; font-size: .8rem; color: #8ea2c0; }

/* ---------- WhatsApp flutuante e barra móvel ---------- */
.eg-wa { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: #25d366; color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); transition: transform .2s; }
.eg-wa:hover { transform: scale(1.06); }
.eg-mbar { display: none; }
@media (max-width: 781px) {
	.eg-wa { display: none; }
	body { padding-bottom: 64px; }
	.eg-mbar { position: fixed; inset: auto 0 0; z-index: 60; display: grid; grid-template-columns: repeat(3, 1fr); height: 64px; background: #fff; box-shadow: 0 -2px 12px rgba(10, 31, 61, .12); }
	.eg-mbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .78rem; font-weight: 700; color: var(--navy); text-decoration: none; }
	.eg-mbar a:nth-child(2) { color: #128c4b; }
	.eg-mbar a:last-child { background: var(--primary); color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	* { transition: none !important; }
}

/* Ajustes finos */
.eg-stat + p { margin-bottom: 28px; }
.eg-card p.eg-note { margin-top: 6px; color: #3d4b5f; font-size: .85rem; }
.wp-block-columns.eg-values { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.eg-values .eg-feature { padding: 20px 8px; }
.eg-values .eg-feature h3 { font-size: .9rem; overflow-wrap: normal; word-break: normal; }
