/*
Theme Name: Uz AdSense
Theme URI: https://uztech.com.br/
Author: Filipe Reis / UzTech
Author URI: https://uztech.com.br/
Description: Tema WordPress genérico para blogs de qualquer nicho, focado em leitura e velocidade. Fase 2 (v1.1.0): motor de anúncios AdSense — 8 posições, painel próprio, ads.txt e consentimento LGPD. v1.1.1: revisão visual do painel AdSense. Nome de trabalho — a marca final ainda será decidida.
Version: 1.1.2
Requires at least: 6.0
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: uz-adsense
Tags: blog, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, two-columns, right-sidebar
*/

/* ============================================================
   Uz AdSense v1.0.0 — Fase 1: esqueleto veloz
   Sem jQuery, sem framework de CSS, sem fonte externa.
   Tipografia: pilha de fontes do sistema (0 KB de fonte).
   ============================================================ */

:root {
  --uz-text: #1c1c1c;
  --uz-muted: #5f6368;
  --uz-bg: #ffffff;
  --uz-surface: #f7f7f5;
  --uz-border: #e3e3e0;
  --uz-accent: #1a5c2e;
  --uz-accent-hover: #12401f;
  --uz-link: #14532d;
  --uz-max: 72rem;
  --uz-content: 44rem;
  --uz-gap: 1.5rem;
  --uz-radius: 0.5rem;
  --uz-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --uz-font-serif: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--uz-bg);
  color: var(--uz-text);
  font-family: var(--uz-font);
  font-size: 1.0625rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

img, video, iframe { max-width: 100%; height: auto; }
img { display: block; }
a { color: var(--uz-link); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { color: var(--uz-accent-hover); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--uz-accent); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.25; overflow-wrap: break-word; }
h1 { font-size: clamp(1.75rem, 1.25rem + 2.5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1.25vw, 1.8rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.25em; }
ul, ol { margin: 0 0 1.25em; padding-left: 1.5rem; }
blockquote { margin: 0 0 1.25em; padding-left: 1rem; border-left: 3px solid var(--uz-accent); color: var(--uz-muted); }
code { font-size: 0.9em; background: var(--uz-surface); padding: 0.1em 0.3em; border-radius: 0.25rem; }
pre { background: var(--uz-surface); padding: 1rem; overflow-x: auto; border-radius: var(--uz-radius); }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--uz-border); margin: 2rem 0; }
table { width: 100%; border-collapse: collapse; margin-bottom: 1.25em; font-size: 0.95rem; }
th, td { padding: 0.5rem; border: 1px solid var(--uz-border); text-align: left; }
figure { margin: 0 0 1.25em; }
figcaption { font-size: 0.875rem; color: var(--uz-muted); margin-top: 0.5rem; }

/* Texto só para leitor de tela */
.screen-reader-text { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Acessibilidade: link "pular para o conteúdo" */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--uz-accent); color: #fff; padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; color: #fff; }

/* Estrutura */
.site { min-height: 100dvh; display: flex; flex-direction: column; }
.site-main { flex: 1; width: 100%; max-width: var(--uz-max); margin: 0 auto; padding: var(--uz-gap) 1rem 3rem; }
.site-content { display: block; }
.content-area { min-width: 0; }
@media (min-width: 64rem) {
  .has-sidebar .site-content { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 2.5rem; align-items: start; }
  .has-sidebar .widget-area { position: sticky; top: 1rem; }
}

/* Cabeçalho */
.site-header { border-bottom: 1px solid var(--uz-border); background: var(--uz-bg); }
.site-header-inner { max-width: var(--uz-max); margin: 0 auto; padding: 0.75rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.site-branding { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.site-branding a { text-decoration: none; color: var(--uz-text); }
.custom-logo { width: auto; max-height: 3rem; }
.site-title { font-size: 1.375rem; font-weight: 700; line-height: 1.2; margin: 0; }
.site-description { font-size: 0.875rem; color: var(--uz-muted); margin: 0; }
.menu-toggle { display: none; margin-left: auto; background: var(--uz-surface); border: 1px solid var(--uz-border); border-radius: var(--uz-radius); padding: 0.5rem 0.75rem; font: inherit; font-size: 0.95rem; cursor: pointer; color: var(--uz-text); }
.primary-navigation { margin-left: auto; }
.primary-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.primary-navigation a { text-decoration: none; color: var(--uz-text); font-size: 0.95rem; padding: 0.25rem 0; }
.primary-navigation a:hover { color: var(--uz-accent); text-decoration: underline; }
.primary-navigation .current-menu-item > a, .primary-navigation .current_page_item > a { font-weight: 700; color: var(--uz-accent); }
@media (max-width: 48rem) {
  .menu-toggle { display: block; }
  .primary-navigation { display: none; flex-basis: 100%; }
  .primary-navigation.toggled { display: block; }
  .primary-navigation ul { flex-direction: column; gap: 0.5rem; padding: 0.5rem 0; }
}

/* Busca no cabeçalho */
.header-search { margin-left: auto; }
.header-search .search-form { display: flex; gap: 0.4rem; }
@media (max-width: 48rem) { .header-search { flex-basis: 100%; margin-left: 0; } }

/* Formulário de busca */
.search-form label { flex: 1; }
.search-field, input[type="search"], input[type="text"], input[type="email"], input[type="url"], textarea {
  width: 100%; font: inherit; font-size: 1rem; padding: 0.55rem 0.75rem;
  border: 1px solid var(--uz-border); border-radius: var(--uz-radius); background: var(--uz-bg); color: var(--uz-text);
}
.search-submit, button, input[type="submit"] {
  font: inherit; font-size: 1rem; padding: 0.55rem 1rem; border: 0; border-radius: var(--uz-radius);
  background: var(--uz-accent); color: #fff; cursor: pointer;
}
.search-submit:hover, button:hover, input[type="submit"]:hover { background: var(--uz-accent-hover); }

/* Listas de posts */
.page-header { margin-bottom: 1.5rem; border-bottom: 1px solid var(--uz-border); padding-bottom: 1rem; }
.page-title { margin: 0; }
.archive-description { color: var(--uz-muted); margin: 0.5rem 0 0; }
.post-grid { display: grid; gap: 2rem; }
@media (min-width: 48rem) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.post-card { display: flex; flex-direction: column; gap: 0.75rem; }
.post-card .post-thumbnail { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--uz-radius); background: var(--uz-surface); }
.post-card .post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.entry-title { margin: 0; font-size: 1.3rem; }
.entry-title a { color: var(--uz-text); text-decoration: none; }
.entry-title a:hover { color: var(--uz-accent); text-decoration: underline; }
.entry-meta { font-size: 0.875rem; color: var(--uz-muted); display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.entry-meta a { color: var(--uz-muted); text-decoration: none; }
.entry-meta a:hover { text-decoration: underline; }
.entry-summary { margin: 0; color: var(--uz-text); }
.entry-summary p { margin: 0; }
.read-more { font-size: 0.95rem; font-weight: 600; }

/* Post único e páginas */
.entry-header { margin-bottom: 1.5rem; }
.entry-header .entry-title { font-size: clamp(1.75rem, 1.25rem + 2.5vw, 2.5rem); }
.post-thumbnail--single { aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--uz-radius); background: var(--uz-surface); margin-bottom: 1.5rem; }
.post-thumbnail--single img { width: 100%; height: 100%; object-fit: cover; }
.entry-content { max-width: var(--uz-content); }
.entry-content > :first-child { margin-top: 0; }
.entry-content img { border-radius: var(--uz-radius); }
.entry-content .alignwide { max-width: var(--uz-max); }
.entry-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--uz-border); font-size: 0.9rem; color: var(--uz-muted); display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.post-navigation { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--uz-border); }
.post-navigation a { text-decoration: none; }
.nav-subtitle { display: block; font-size: 0.8rem; color: var(--uz-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Caixa do autor (E-E-A-T — Fase 1 só exibe; o kit de aprovação completo é fase posterior) */
.author-box { display: flex; gap: 1rem; background: var(--uz-surface); border-radius: var(--uz-radius); padding: 1.25rem; margin-top: 2.5rem; }
.author-box .avatar { border-radius: 50%; flex-shrink: 0; }
.author-box h2 { font-size: 1.05rem; margin: 0 0 0.25rem; }
.author-box p { margin: 0; font-size: 0.95rem; color: var(--uz-muted); }

/* Breadcrumb */
.breadcrumbs { font-size: 0.85rem; color: var(--uz-muted); margin-bottom: 1rem; }
.breadcrumbs a { color: var(--uz-muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--uz-text); }

/* Sidebar / widgets */
.widget-area { display: flex; flex-direction: column; gap: 2rem; }
.widget { margin: 0; }
.widget-title { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--uz-accent); }
.widget ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.widget a { text-decoration: none; }
.widget a:hover { text-decoration: underline; }

/* Paginação */
.pagination { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pagination .page-numbers { padding: 0.4rem 0.8rem; border: 1px solid var(--uz-border); border-radius: var(--uz-radius); text-decoration: none; color: var(--uz-text); }
.pagination .page-numbers.current { background: var(--uz-accent); border-color: var(--uz-accent); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--uz-accent); }

/* Comentários */
.comments-area { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--uz-border); }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.comment-body { display: flex; flex-direction: column; gap: 0.5rem; }
.comment-meta { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; color: var(--uz-muted); }
.comment-meta .avatar { border-radius: 50%; }
.comment-content p { margin: 0 0 0.75em; }
.comment-reply-link { font-size: 0.9rem; }
.comment-form label { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; }
.comment-form p { margin-bottom: 1rem; }

/* Nada encontrado / 404 */
.not-found { max-width: var(--uz-content); }
.not-found .page-title { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }

/* Rodapé */
.site-footer { border-top: 1px solid var(--uz-border); background: var(--uz-surface); margin-top: auto; }
.site-footer-inner { max-width: var(--uz-max); margin: 0 auto; padding: 2rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; font-size: 0.9rem; color: var(--uz-muted); }
.site-footer a { color: var(--uz-muted); }
.footer-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }

/* Impressão: sem navegação nem sidebar */
@media print {
  .site-header, .site-footer, .widget-area, .comments-area, .post-navigation, .menu-toggle { display: none !important; }
  body { font-size: 12pt; }
  a { color: inherit; }
}

/* ============================================================
   Anúncios — Uz AdSense v1.1.1 (Fase 2, revisão visual do painel)
   Anti-CLS: cada slot nasce com altura mínima reservada (o valor
   exato vem inline do PHP, por dispositivo). Sem código
   configurado, o slot nem é renderizado — nada de espaço vazio.
   ============================================================ */

/* Slot genérico: reserva o espaço, não empurra o texto. */
.uz-ad { margin: 1.5rem 0; overflow: hidden; }
.uz-ad ins.adsbygoogle { display: block; }
/* Topo e fim do artigo centralizam o bloco. */
.uz-ad--top, .uz-ad--end, .uz-ad--infeed { text-align: center; }
/* Sidebar: o slot fica antes dos widgets, sem quebrar o sticky. */
.uz-ad--sidebar { margin: 0 0 2rem; }

/* Segunda camada do controle por dispositivo (a primeira é o
   wp_is_mobile() no servidor): esconde por breakpoint. */
@media (max-width: 48rem) {
  .uz-ad--desktop-only { display: none; }
}
@media (min-width: 48.01rem) {
  .uz-ad--mobile-only { display: none; }
}

/* Prévia (?uz_ads_preview=1, só admin): contorno tracejado + nome. */
.uz-ad--preview {
  border: 2px dashed #8c8f94;
  background: repeating-linear-gradient(45deg, #f6f7f7, #f6f7f7 10px, #fff 10px, #fff 20px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}
.uz-ad__label { font-size: 0.85rem; color: #50575e; font-weight: 600; }

/* Âncora mobile: fixa embaixo, só até 48rem. O rodapé ganha
   respiro (padding-bottom) só enquanto ela está visível, via a
   classe .uz-anchor-visible no body — o JS a remove ao fechar. */
.uz-anchor {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: #fff;
  border-top: 1px solid var(--uz-border);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}
.uz-anchor .uz-ad { margin: 0 auto; max-width: 48rem; }
.uz-anchor__close {
  position: absolute;
  top: -2rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  background: #1c1c1c;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
body.uz-anchor-visible .site-footer { padding-bottom: 4.5rem; }
@media (min-width: 48.01rem) {
  .uz-anchor { display: none; }
}

/* Vinheta: overlay próprio do tema, uma vez por sessão. */
.uz-vignette {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.uz-vignette__box {
  position: relative;
  width: 100%;
  max-width: 40rem;
  background: #fff;
  border-radius: var(--uz-radius);
  padding: 2.5rem 1rem 1rem;
}
.uz-vignette__box .uz-ad { margin: 0; }
.uz-vignette__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: #1c1c1c;
  color: #fff;
  border-radius: var(--uz-radius);
  font-size: 0.9rem;
  cursor: pointer;
}

/* Banner de consentimento LGPD (Consent Mode). */
.uz-consent {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1001;
  max-width: 40rem;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--uz-border);
  border-radius: var(--uz-radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  padding: 1rem 1.25rem;
  font-size: 0.95rem;
}
.uz-consent p { margin: 0 0 0.75rem; }
.uz-consent__refuse { background: var(--uz-surface); color: var(--uz-text); border: 1px solid var(--uz-border); }
