/*
Theme Name: Fórmula Flex Tech
Theme URI: https://www.formulaflex.com.br
Author: Sandro Vieira
Description: Block theme dark-first para blog de IA, automação e dados. Tipografia Space Grotesk + Inter + JetBrains Mono, cards com hover accent, tags mono coloridas por categoria e barra de progresso de leitura.
Version: 1.3.1
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: formulaflex-tech
*/

/* ===================================================
   INTERAÇÕES E DETALHES QUE O theme.json NÃO COBRE
   =================================================== */

/* ---------- Cards de post: borda acende no hover ---------- */
.ff-card {
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	overflow: hidden;
	transition: border-color .2s ease, transform .2s ease;
}
.ff-card:hover {
	border-color: var(--wp--preset--color--accent);
	transform: translateY(-3px);
}
.ff-card .wp-block-post-title a {
	text-decoration: none;
	color: var(--wp--preset--color--foreground);
}
.ff-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent);
}
.ff-card .wp-block-post-featured-image img {
	transition: transform .3s ease;
}
.ff-card:hover .wp-block-post-featured-image img {
	transform: scale(1.03);
}

/* ---------- Cards com altura uniforme no grid ---------- */
.wp-block-post-template.is-layout-grid > li.wp-block-post {
	display: flex;
}
.wp-block-post-template.is-layout-grid > li.wp-block-post > .ff-card {
	flex: 1;
	display: flex;
	flex-direction: column;
}
/* wrapper de texto do card ocupa o restante da altura */
.ff-card > .wp-block-group:last-child {
	flex: 1;
	display: flex;
	flex-direction: column;
}
/* data sempre ancorada no rodapé do card */
.ff-card .ff-meta {
	margin-top: auto;
	padding-top: 4px;
}
/* título limitado a 3 linhas */
.ff-card .wp-block-post-title {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
/* resumo limitado a 3 linhas */
.ff-card .wp-block-post-excerpt__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
}
.ff-card .wp-block-post-excerpt {
	margin: 0;
}

/* ---------- Tags de categoria em pill mono ---------- */
.wp-block-post-terms.ff-terms a,
.ff-chip {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	line-height: 1;
	text-transform: lowercase;
	letter-spacing: .02em;
	border: 1px solid var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
	padding: 5px 12px;
	border-radius: 4px;
	text-decoration: none;
	display: inline-block;
	transition: background .15s ease, color .15s ease;
}
.wp-block-post-terms.ff-terms a:hover,
.ff-chip:hover {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
}
.wp-block-post-terms.ff-terms .wp-block-post-terms__separator {
	display: none;
}
.wp-block-post-terms.ff-terms {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

/* ---------- Cor por categoria ---------- */
.category-ia .wp-block-post-terms.ff-terms a          { border-color:#8B5CF6; color:#8B5CF6; }
.category-ia .wp-block-post-terms.ff-terms a:hover    { background:#8B5CF6; color:#0A0E14; }
.category-automacao .wp-block-post-terms.ff-terms a       { border-color:#22D3EE; color:#22D3EE; }
.category-automacao .wp-block-post-terms.ff-terms a:hover { background:#22D3EE; color:#0A0E14; }
.category-dados .wp-block-post-terms.ff-terms a       { border-color:#10B981; color:#10B981; }
.category-dados .wp-block-post-terms.ff-terms a:hover { background:#10B981; color:#0A0E14; }
.category-ferramentas .wp-block-post-terms.ff-terms a       { border-color:#F59E0B; color:#F59E0B; }
.category-ferramentas .wp-block-post-terms.ff-terms a:hover { background:#F59E0B; color:#0A0E14; }
.category-robotica .wp-block-post-terms.ff-terms a       { border-color:#F472B6; color:#F472B6; }
.category-robotica .wp-block-post-terms.ff-terms a:hover { background:#F472B6; color:#0A0E14; }

/* ---------- Hero: grid pattern estilo blueprint ---------- */
.ff-hero {
	background-color: var(--wp--preset--color--background);
	background-image:
		linear-gradient(var(--wp--preset--color--surface) 1px, transparent 1px),
		linear-gradient(90deg, var(--wp--preset--color--surface) 1px, transparent 1px);
	background-size: 32px 32px;
	border-bottom: 1px solid var(--wp--preset--color--border);
}
.ff-eyebrow {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	color: var(--wp--preset--color--accent);
	letter-spacing: .03em;
}

/* ---------- Metadados em mono ---------- */
.ff-meta,
.ff-meta .wp-block-post-date,
.ff-meta time {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 11px;
	color: var(--wp--preset--color--muted);
}

/* ---------- Header ---------- */
.ff-header {
	border-bottom: 1px solid var(--wp--preset--color--border);
	position: relative;
	z-index: 50;
}
.ff-logo-prompt {
	font-family: var(--wp--preset--font-family--mono);
	color: var(--wp--preset--color--accent);
	font-weight: 500;
}
.ff-header .wp-block-navigation a {
	font-size: 14px;
	color: var(--wp--preset--color--secondary);
	transition: color .15s ease;
}
.ff-header .wp-block-navigation a:hover {
	color: var(--wp--preset--color--accent);
}

/* ---------- Logo (Site Logo block) ---------- */
.ff-logo img {
	max-height: 40px;
	width: auto;
	object-fit: contain;
}
.ff-footer .ff-logo img {
	max-height: 34px;
}

/* ---------- Ícones sociais ---------- */
.ff-social .wp-block-social-link a {
	transition: transform .15s ease;
}
.ff-social .wp-block-social-link a:hover {
	transform: translateY(-2px);
}
.ff-social .wp-block-social-link a:hover svg {
	fill: var(--wp--preset--color--accent);
}

/* ---------- Footer ---------- */
.ff-footer {
	border-top: 1px solid var(--wp--preset--color--border);
}
.ff-footer a {
	color: var(--wp--preset--color--secondary);
	text-decoration: none;
}
.ff-footer a:hover {
	color: var(--wp--preset--color--accent);
}

/* ---------- Barra de progresso de leitura ---------- */
#ff-progress {
	position: fixed;
	top: 0;
	left: 0;
	height: 2px;
	width: 0;
	background: var(--wp--preset--color--accent);
	z-index: 9999;
}

/* ---------- Formulários (newsletter, busca, comentários) ---------- */
input[type="email"],
input[type="text"],
input[type="search"],
input[type="url"],
textarea,
.wp-block-search__input {
	background: var(--wp--preset--color--surface) !important;
	border: 1px solid var(--wp--preset--color--border) !important;
	color: var(--wp--preset--color--foreground) !important;
	border-radius: 6px !important;
	padding: 10px 14px;
}
input:focus,
textarea:focus,
.wp-block-search__input:focus {
	border-color: var(--wp--preset--color--accent) !important;
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}

/* ---------- Blocos de código ---------- */
pre.wp-block-code,
pre.wp-block-preformatted {
	background: #0D1117;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 8px;
	padding: 20px;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 14px;
	overflow-x: auto;
}
code {
	font-family: var(--wp--preset--font-family--mono);
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	padding: 2px 6px;
	font-size: .9em;
}
pre code {
	background: none;
	border: none;
	padding: 0;
}

/* ---------- Citações ---------- */
blockquote.wp-block-quote {
	border-left: 2px solid var(--wp--preset--color--accent);
	border-radius: 0;
	padding-left: 20px;
	color: var(--wp--preset--color--secondary);
	font-style: normal;
}

/* ---------- Paginação ---------- */
.wp-block-query-pagination a,
.wp-block-query-pagination-numbers .page-numbers {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 13px;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 4px;
	padding: 6px 12px;
	text-decoration: none;
	color: var(--wp--preset--color--secondary);
	transition: border-color .15s ease, color .15s ease;
}
.wp-block-query-pagination a:hover {
	border-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--accent);
}
.wp-block-query-pagination-numbers .page-numbers.current {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
	border-color: var(--wp--preset--color--accent);
}

/* ---------- Seleção de texto ---------- */
::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--background);
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--wp--preset--color--background); }
::-webkit-scrollbar-thumb {
	background: var(--wp--preset--color--border);
	border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--wp--preset--color--muted); }

/* ===================================================
   RESPONSIVO (mobile-first fixes)
   =================================================== */

/* ---------- Menu mobile: hambúrguer visível no tema dark ---------- */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	color: var(--wp--preset--color--foreground) !important;
}
.wp-block-navigation__responsive-container-open svg,
.wp-block-navigation__responsive-container-close svg {
	fill: currentColor;
	width: 28px;
	height: 28px;
}

/* Overlay do menu aberto: fundo dark, tela cheia, acima de todo o conteúdo */
.wp-block-navigation__responsive-container.has-modal-open {
	background-color: var(--wp--preset--color--background) !important;
	padding: 24px;
	position: fixed !important;
	inset: 0 !important;
	z-index: 100000 !important;
}
/* botão de fechar sempre visível no topo direito do overlay */
.wp-block-navigation__responsive-container.has-modal-open .wp-block-navigation__responsive-container-close {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 100001;
}
.wp-block-navigation__responsive-container.has-modal-open .wp-block-navigation-item__content {
	color: var(--wp--preset--color--foreground) !important;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.25rem;
	padding: 10px 0;
}
.wp-block-navigation__responsive-container.has-modal-open .wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--accent) !important;
}
.wp-block-navigation__responsive-container.has-modal-open .wp-block-navigation__container {
	gap: 4px;
}

/* ---------- Grid de cards: 3 → 2 → 1 colunas ---------- */
@media (max-width: 991px) {
	.wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}
@media (max-width: 599px) {
	.wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}
}

/* ---------- Header compacto no mobile ---------- */
@media (max-width: 781px) {
	.ff-header {
		padding-left: 16px;
		padding-right: 16px;
	}
	.ff-header > .wp-block-group {
		gap: 12px;
	}
	.ff-logo img {
		max-height: 32px;
	}
}
@media (max-width: 480px) {
	/* botão Assinar encolhe para não disputar espaço com o hambúrguer */
	.ff-header .wp-block-button__link {
		padding: 5px 12px !important;
		font-size: 12px;
	}
}

/* ---------- Hero compacto no mobile ---------- */
@media (max-width: 781px) {
	.ff-hero {
		padding-top: var(--wp--preset--spacing--50) !important;
		padding-bottom: var(--wp--preset--spacing--50) !important;
		background-size: 24px 24px;
	}
}

/* ---------- Footer empilhado no mobile ---------- */
@media (max-width: 781px) {
	.ff-footer > .wp-block-group {
		flex-direction: column;
		gap: 32px;
	}
}

/* ---------- Conteúdo de post: respiro lateral no mobile ---------- */
@media (max-width: 781px) {
	main.wp-block-group {
		padding-left: 16px;
		padding-right: 16px;
	}
	pre.wp-block-code {
		font-size: 13px;
		padding: 14px;
	}
}

/* ---------- Toque: alvos maiores para dedo ---------- */
@media (hover: none) {
	.ff-chip,
	.wp-block-post-terms.ff-terms a {
		padding: 8px 14px;
	}
}


/* ---------- Acessibilidade: reduz movimento ---------- */
@media (prefers-reduced-motion: reduce) {
	.ff-card, .ff-card .wp-block-post-featured-image img {
		transition: none;
	}
	.ff-card:hover { transform: none; }
}
