/*
Theme Name: PANIMI School
Theme URI: https://panimi.digital/school/
Author: PANIMI
Description: Tema de blocos da PANIMI School, a área editorial e educacional da PANIMI. Feito para leitura, com o editor nativo de blocos (Gutenberg) e os tokens do PANIMI Design System v2.0. Não carrega recursos de terceiros nem exige plugins.
Version: 0.2.0
Requires at least: 6.6
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: panimi-school
Tags: blog, education, full-site-editing, block-patterns, custom-colors, editor-style, accessibility-ready, translation-ready

Tokens (cores, tipografia, espaçamento, raios, larguras) ficam em theme.json e chegam aqui como variáveis
--wp--preset--* e --wp--custom--*. Este arquivo só trata do que o theme.json não expressa: foco, ritmo
vertical do artigo, tabelas, listas, responsividade e movimento reduzido. Não declare cores novas aqui.
*/

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* O gap raiz do WordPress não deve separar cabeçalho, conteúdo e rodapé. */
.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }
.wp-site-blocks { min-height: 100vh; display: flex; flex-direction: column; }
.wp-site-blocks > main { flex: 1 0 auto; }

/* ---------- Escala tipográfica do DS (line-height por tamanho) ---------- */
.has-label-sm-font-size { line-height: 1.3333; }
.has-body-sm-font-size { line-height: 1.4286; }
.has-body-md-font-size { line-height: 1.5; }
.has-body-lg-font-size { line-height: 1.5556; }
.has-heading-sm-font-size { line-height: 1.4; letter-spacing: -0.01em; }
.has-heading-md-font-size { line-height: 1.3333; letter-spacing: -0.02em; }
.has-heading-lg-font-size { line-height: 1.2; letter-spacing: -0.02em; }
.has-heading-xl-font-size { line-height: 1.2222; letter-spacing: -0.02em; }
.has-display-font-size { line-height: 1.1667; letter-spacing: -0.02em; font-weight: 700; }

/* Escala mobile do DS (01-fundamentos): display 36/44 · heading-xl 28/36 · heading-lg 24/32 abaixo de 768px. */
@media (max-width: 767.98px) {
	html:root {
		--wp--preset--font-size--display: 36px;
		--wp--preset--font-size--heading-xl: 28px;
		--wp--preset--font-size--heading-lg: 24px;
	}
	.has-display-font-size { line-height: 1.2222; }
	.has-heading-xl-font-size, h1 { line-height: 1.2857; }
	.has-heading-lg-font-size, h2 { line-height: 1.3333; }
}

/* ---------- Foco visível (DS, Acessibilidade): 2px border-focus, afastamento de 2px ---------- */
:focus-visible {
	outline: 2px solid var(--wp--preset--color--border-focus);
	outline-offset: 2px;
}
.wp-block-navigation__responsive-container.is-menu-open :focus-visible { outline-offset: 2px; }
/* O contorno padrão do campo de busca vem do wrapper; o foco fica no input. */
.wp-block-search__input:focus-visible { outline: 2px solid var(--wp--preset--color--border-focus); outline-offset: 2px; }

/* Link para pular ao conteúdo (adicionado pelo WordPress em temas de blocos). */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--surface-default);
	color: var(--wp--preset--color--text-primary);
	border-radius: var(--wp--custom--radius--md);
	box-shadow: none;
	outline: 2px solid var(--wp--preset--color--border-focus);
	padding: 12px 20px;
	font-size: var(--wp--preset--font-size--body-md);
	font-weight: 600;
	text-decoration: none;
	top: 8px; left: 8px;
}

/* ---------- Cabeçalho e rodapé ---------- */
.panimi-cabecalho { border-bottom: 1px solid var(--wp--preset--color--border-default); background: var(--wp--preset--color--surface-default); }
.panimi-marca { gap: 12px; }
.panimi-marca .wp-block-image { margin: 0; line-height: 0; }
.panimi-marca .wp-block-image img { display: block; height: 24px; width: auto; }
.panimi-marca__rotulo { margin: 0; padding-inline-start: 12px; border-inline-start: 1px solid var(--wp--preset--color--border-default); }
.panimi-marca__rotulo a { color: var(--wp--preset--color--text-primary); text-decoration: none; font-weight: 600; }
.panimi-marca__rotulo a:hover { text-decoration: underline; }
.panimi-marca a { display: inline-flex; align-items: center; min-height: var(--wp--custom--touch-target); }

.wp-block-navigation .wp-block-navigation-item__content { padding-block: 10px; }
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-item__content[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; text-decoration-color: var(--wp--preset--color--text-brand); }
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close { min-width: var(--wp--custom--touch-target); min-height: var(--wp--custom--touch-target); }
.wp-block-navigation__responsive-container.is-menu-open { background: var(--wp--preset--color--surface-default); color: var(--wp--preset--color--text-primary); }

.panimi-rodape { border-top: 1px solid var(--wp--preset--color--border-default); background: var(--wp--preset--color--surface-default); }
.panimi-rodape__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 24px; }
.wp-block-list.panimi-rodape__links { padding-inline-start: 0; }
.wp-block-list.panimi-rodape__links li { margin: 0; padding-inline-start: 0; }
.panimi-rodape__links a { display: inline-flex; align-items: center; min-height: var(--wp--custom--touch-target); }

/* ---------- Listagem editorial ---------- */
.panimi-item { display: flex; align-items: flex-start; gap: 24px; border-bottom: 1px solid var(--wp--preset--color--border-default); padding-block: var(--wp--preset--spacing--s-6); }
.wp-block-post-template > li:first-child .panimi-item { padding-block-start: 0; }
.panimi-item__texto { flex: 1 1 0; min-width: 0; }
.panimi-item__imagem { flex: 0 0 160px; width: 160px; margin: 0; }
.panimi-item .wp-block-post-featured-image { margin: 0; }
.panimi-item__imagem img { width: 100%; height: auto; display: block; object-fit: cover; }
.panimi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0; }
.panimi-meta > * { margin: 0; }
.wp-block-post-terms a { display: inline-flex; align-items: center; min-height: 24px; color: var(--wp--preset--color--text-brand); font-weight: 600; text-decoration: none; }
.wp-block-post-terms a:hover { text-decoration: underline; }
.wp-block-post-terms .wp-block-post-terms__separator { color: var(--wp--preset--color--text-muted); }
.panimi-item .wp-block-post-title { margin: 0; }
.panimi-item .wp-block-post-excerpt { margin-block-start: 8px; }
.panimi-item .wp-block-post-excerpt__excerpt { margin: 0; }
@media (max-width: 599.98px) {
	.panimi-item { flex-direction: column-reverse; gap: 16px; }
	.panimi-item__imagem { flex-basis: auto; width: 100%; max-width: 320px; }
}

.panimi-eyebrow { margin: 0; color: var(--wp--preset--color--text-muted); font-size: var(--wp--preset--font-size--label-md); font-weight: 600; line-height: 1.4286; }

/* Paginação */
.wp-block-query-pagination { gap: 8px 16px; margin-block-start: var(--wp--preset--spacing--s-8); }
.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: var(--wp--custom--touch-target); min-height: var(--wp--custom--touch-target); padding-inline: 8px; border-radius: var(--wp--custom--radius--md); font-size: var(--wp--preset--font-size--body-md); font-weight: 600; text-decoration: none; color: var(--wp--preset--color--text-primary); }
.wp-block-query-pagination a:hover { background: var(--wp--preset--color--surface-sunken); }
.wp-block-query-pagination-numbers { display: flex; flex-wrap: wrap; gap: 4px; }
.wp-block-query-pagination .page-numbers.current { background: var(--wp--preset--color--surface-sunken); border: 1px solid var(--wp--preset--color--border-default); }

/* ---------- Artigo ---------- */
.panimi-artigo-cabecalho .wp-block-post-title { margin: 0; }
.panimi-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; color: var(--wp--preset--color--text-muted); font-size: var(--wp--preset--font-size--body-sm); line-height: 1.4286; }
.panimi-byline > * { margin: 0; }
.panimi-byline .wp-block-post-author { display: flex; flex-wrap: nowrap; gap: 4px; align-items: baseline; }
.panimi-byline .wp-block-post-author__content { display: flex; flex-wrap: nowrap; gap: 4px; flex-grow: 0; white-space: nowrap; }
.panimi-byline .wp-block-post-author__byline,
.panimi-byline .wp-block-post-author__name { margin: 0; font-size: inherit; }
.panimi-byline .wp-block-post-author__name { font-weight: 600; color: var(--wp--preset--color--text-secondary); }

.wp-block-post-featured-image img { width: 100%; height: auto; display: block; }

/* Ritmo vertical do conteúdo do artigo */
.wp-block-post-content > :is(h2) { margin-block-start: var(--wp--preset--spacing--s-12); }
.wp-block-post-content > :is(h3) { margin-block-start: var(--wp--preset--spacing--s-10); }
.wp-block-post-content > :is(h4, h5, h6) { margin-block-start: var(--wp--preset--spacing--s-8); }
.wp-block-post-content > :is(h2, h3, h4, h5, h6) + * { margin-block-start: var(--wp--preset--spacing--s-4); }
.wp-block-post-content > :is(figure, .wp-block-table, .wp-block-quote, .wp-block-pullquote, .wp-block-group, .wp-block-details, pre, .wp-block-embed) { margin-block-start: var(--wp--preset--spacing--s-8); margin-block-end: 0; }
.wp-block-post-content > :is(figure, .wp-block-table, .wp-block-quote, .wp-block-pullquote, .wp-block-group, .wp-block-details, pre, .wp-block-embed) + * { margin-block-start: var(--wp--preset--spacing--s-8); }

/* Parágrafo "lide": subtítulo/introdução do artigo */
.is-style-lead { font-size: var(--wp--preset--font-size--heading-sm); line-height: 1.4; color: var(--wp--preset--color--text-secondary); }

/* Listas */
.wp-block-post-content :is(ul, ol), .wp-block-list { padding-inline-start: 1.5em; }
.wp-block-post-content li, .wp-block-list li { margin-block: 8px; padding-inline-start: 4px; }
.wp-block-post-content li > :is(ul, ol) { margin-block-start: 8px; }
.wp-block-post-content li::marker { color: var(--wp--preset--color--text-muted); }

/* Links dentro do texto */
.wp-block-post-content a:not(.wp-element-button), .wp-block-page-content a:not(.wp-element-button) { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.wp-block-post-content a:not(.wp-element-button):hover { text-decoration-thickness: 2px; }

/* Imagens e legendas */
.wp-block-image img, .wp-block-post-content img { max-width: 100%; height: auto; }
.wp-block-image figcaption, .wp-block-embed figcaption, .wp-block-table figcaption, .wp-block-gallery figcaption {
	margin-block-start: 8px; margin-block-end: 0; color: var(--wp--preset--color--text-muted); font-size: var(--wp--preset--font-size--body-sm); line-height: 1.4286; text-align: start;
}

/* Citações */
.wp-block-quote p { font-size: var(--wp--preset--font-size--heading-sm); line-height: 1.4; margin: 0; }
.wp-block-quote p + p { margin-block-start: 16px; }
.wp-block-quote cite, .wp-block-quote .wp-block-quote__citation { display: block; margin-block-start: 12px; font-size: var(--wp--preset--font-size--body-sm); font-style: normal; font-weight: 600; color: var(--wp--preset--color--text-muted); }
.wp-block-pullquote { text-align: start; }
.wp-block-pullquote p { font-size: var(--wp--preset--font-size--heading-sm); line-height: 1.4; font-weight: 600; margin: 0; }
.wp-block-pullquote cite { display: block; margin-block-start: 12px; font-size: var(--wp--preset--font-size--body-sm); font-style: normal; color: var(--wp--preset--color--text-muted); }

/* Tabelas */
.wp-block-table { overflow-x: auto; }
.wp-block-table table { border-collapse: collapse; width: 100%; font-size: var(--wp--preset--font-size--body-md); line-height: 1.5; }
.wp-block-table :is(th, td) { border: 1px solid var(--wp--preset--color--border-default); padding: 12px 16px; text-align: start; vertical-align: top; }
.wp-block-table th, .wp-block-table thead td { background: var(--wp--preset--color--surface-subtle); font-weight: 600; }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) { background: var(--wp--preset--color--surface-subtle); }
.wp-block-table.is-style-stripes { border: 0; }

/* Código, separador, detalhes */
.wp-block-code code { background: none; padding: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.wp-block-separator { border: 0; border-top: 1px solid var(--wp--preset--color--border-default); background: none; opacity: 1; }
.wp-block-details { border: 1px solid var(--wp--preset--color--border-default); border-radius: var(--wp--custom--radius--lg); padding: 0; background: var(--wp--preset--color--surface-default); }
.wp-block-details summary { cursor: pointer; padding: 12px 16px; min-height: var(--wp--custom--touch-target); font-weight: 600; }
.wp-block-details > :not(summary) { padding-inline: 16px; }
.wp-block-details > :last-child { padding-block-end: 16px; }

/* Nota editorial (padrão "Nota do editor") */
.panimi-nota { border: 1px solid var(--wp--preset--color--feedback-info-border); background: var(--wp--preset--color--feedback-info-bg); border-radius: var(--wp--custom--radius--lg); color: var(--wp--preset--color--text-primary); }
.panimi-nota > * { margin-block: 0; }
.panimi-nota > * + * { margin-block-start: 8px; }
.panimi-nota .panimi-nota__titulo { color: var(--wp--preset--color--text-info); font-weight: 600; }

/* ---------- Botões e busca ---------- */
.wp-block-button__link, .wp-element-button { min-height: var(--wp--custom--touch-target); display: inline-flex; align-items: center; justify-content: center; transition: background-color var(--wp--custom--duration--normal) ease; }
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent; color: var(--wp--preset--color--text-primary); border: 1px solid var(--wp--preset--color--border-control);
}
.wp-block-button.is-style-outline > .wp-block-button__link:hover { background: var(--wp--preset--color--action-secondary-hover); border-color: var(--wp--preset--color--border-control-hover); color: var(--wp--preset--color--text-primary); }

.wp-block-search__inside-wrapper { gap: 8px; }
.wp-block-search__input {
	min-height: var(--wp--custom--touch-target); padding: 8px 12px; font: inherit; font-size: var(--wp--preset--font-size--body-md); line-height: 1.5;
	color: var(--wp--preset--color--text-primary); background: var(--wp--preset--color--surface-default);
	border: 1px solid var(--wp--preset--color--border-control); border-radius: var(--wp--custom--radius--md);
}
.wp-block-search__input:hover { border-color: var(--wp--preset--color--border-control-hover); }
.wp-block-search__button { margin: 0; min-height: var(--wp--custom--touch-target); border-radius: var(--wp--custom--radius--md); border: 0; padding: 8px 20px; font: inherit; font-size: var(--wp--preset--font-size--body-md); font-weight: 600; background: var(--wp--preset--color--action-primary); color: var(--wp--preset--color--text-inverse); cursor: pointer; }
.wp-block-search__button:hover { background: var(--wp--preset--color--action-primary-hover); }
.wp-block-search__button:active { background: var(--wp--preset--color--action-primary-pressed); }
.wp-block-search .wp-block-search__label { font-weight: 600; }

/* ---------- Navegação entre artigos ---------- */
.panimi-artigo-rodape { border-top: 1px solid var(--wp--preset--color--border-default); }
.panimi-artigo-rodape .wp-block-post-navigation-link a { text-decoration: none; font-weight: 600; color: var(--wp--preset--color--text-primary); }
.panimi-artigo-rodape .wp-block-post-navigation-link a:hover { text-decoration: underline; }
.panimi-artigo-rodape .post-navigation-link__label { display: block; font-size: var(--wp--preset--font-size--body-sm); font-weight: 400; color: var(--wp--preset--color--text-muted); }

/* ---------- Movimento reduzido (DS, Acessibilidade) ---------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
