/*
Theme Name: ADMonetiza
Theme URI: https://example.com/admonetiza
Author: Isaac
Author URI: https://example.com
Description: Tema minimalista mobile-first para blogs de finanças/cartão de crédito, otimizado para AdSense. Menu superior simples, logo pequena, título compacto, botões de CTA e espaços de anúncio estratégicos.
Version: 1.3.1
Requires at least: 6.0
Requires PHP: 7.4
Tested up to: 6.6
License: GNU General Public License v2 or later
License URI: LICENSE
Text Domain: admonetiza
Tags: blog, minimal, one-column, custom-logo, custom-menu, translation-ready
*/

/* ==========================================================================
   1. RESET & VARIÁVEIS
   ========================================================================== */

:root {
  --color-primary: #14213d;      /* azul marinho - confiança */
  --color-primary-light: #1f3a63;
  --color-accent: #d4a017;       /* dourado - cartão premium */
  --color-accent-hover: #b8890f;
  --color-link-post: #d4a017;    /* cor dos links dentro do texto do post */
  --color-link-post-hover: #b8890f;
  --color-bg: #ffffff;
  --color-bg-alt: #f5f6f8;
  --color-text: #1c1c1c;
  --color-muted: #5f6368;
  --color-border: #e6e8eb;
  --color-ad-bg: #f0f1f3;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --container-width: 720px;
  --radius: 8px;
  --header-height: 56px;
  /* Altura reservada pro menu inferior no mobile, agora empilhado (um item
     embaixo do outro). Estimada pra até uns 4 itens — se o menu tiver mais
     itens que isso, aumente esse valor pra não sobrar espaço curto. */
  --bottom-nav-height: 150px;
}

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

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

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  /* espaço para o menu inferior fixo não cobrir o conteúdo no mobile */
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

ul, ol { padding-left: 1.2em; }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ==========================================================================
   2. HEADER / MENU SUPERIOR
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.site-branding img.custom-logo {
  max-height: 28px;
  width: auto;
}

.site-branding .site-title-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-primary);
  position: relative;
  transition: transform .2s ease;
}
.menu-toggle span::before { position: absolute; top: -6px; }
.menu-toggle span::after { position: absolute; top: 6px; }

.primary-navigation {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.primary-navigation.is-open { display: block; }

.primary-navigation ul {
  list-style: none;
  margin: 0;
  padding: 8px 16px 12px;
}

.primary-navigation li { border-bottom: 1px solid var(--color-border); }
.primary-navigation li:last-child { border-bottom: none; }

.primary-navigation a {
  display: block;
  padding: 10px 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

/* ==========================================================================
   3. HERO: TÍTULO (posts, páginas, arquivos — não aparece na home)
   ========================================================================== */

.page-hero {
  padding: 16px 0 10px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}

.page-hero__title {
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0;
  color: var(--color-primary);
  font-weight: 700;
  text-align: center;
}

/* ==========================================================================
   4. CONTEÚDO
   ========================================================================== */

.site-main { padding: 16px 0 32px; }

.entry {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}
.entry:last-child { border-bottom: none; }

.entry-thumbnail { border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }

/* Post/página com a imagem destacada ligada em Personalizar (desligada por
   padrão): imagem contida, com cantos arredondados, proporção reservada
   desde o início para não causar troca de layout ao carregar. */
.entry-thumbnail--single img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

/* Home (feed): imagem sangra até a borda da tela e fica maior no mobile,
   para os posts preencherem a tela toda ao rolar. */
.content-area--feed .entry-thumbnail {
  margin: 0 -16px 10px;
  border-radius: 0;
}
.content-area--feed .entry-thumbnail img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}
.entry--feed { padding-bottom: 20px; margin-bottom: 20px; }

.entry-title {
  font-size: 1.1rem;
  line-height: 1.35;
  margin: 0 0 6px;
}
.entry-title a { color: var(--color-text); }

.entry-meta {
  font-size: 12px;
  color: var(--color-muted);
  margin-bottom: 8px;
}

/* Em posts, a data/categoria some do início e aparece no fim do artigo. */
.entry-meta--footer {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.entry-content, .entry-summary {
  /* 16px é o tamanho mínimo recomendado pelo Google para texto de leitura no mobile
     (evita zoom automático e atende ao critério de legibilidade do Lighthouse/PageSpeed). */
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
}

.entry-content p, .entry-summary p { margin: 0 0 14px; }

.entry-content h2 { font-size: 1.15rem; margin: 22px 0 10px; color: var(--color-primary); }
.entry-content h3 { font-size: 1.02rem; margin: 18px 0 8px; color: var(--color-primary); }

/* Links dentro do texto do post (só posts, não páginas nem a home): cor
   laranja/dourada, para se destacar do texto normal sem virar um botão. */
body.single .entry-content a {
  color: var(--color-link-post);
  text-decoration: underline;
}
body.single .entry-content a:hover {
  color: var(--color-link-post-hover);
}

/* Tabelas largas coladas no editor não devem quebrar o layout no mobile:
   a tabela rola na horizontal dentro do próprio wrapper, não a página toda. */
.entry-content .table-wrap,
.entry-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.entry-content table {
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 14px 0;
}
.entry-content table th, .entry-content table td {
  border: 1px solid var(--color-border);
  padding: 8px;
  text-align: left;
}

.related-posts {
  margin: 20px 0;
  padding: 16px 0 4px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.related-posts__title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  margin: 0 0 12px;
}

.related-posts__list { list-style: none; margin: 0; padding: 0; }

.related-posts__item { margin-bottom: 14px; }
.related-posts__item:last-child { margin-bottom: 12px; }

.related-posts__link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.related-posts__thumb {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: #e1e4e8;
}
.related-posts__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-posts__body { min-width: 0; }

.related-posts__item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 3px;
}

.related-posts__excerpt {
  display: block;
  font-size: 12px;
  color: var(--color-muted);
  line-height: 1.4;
}

.read-more {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
}

/* ==========================================================================
   6. SIDEBAR
   ========================================================================== */

.widget-area { margin-top: 24px; }
.widget { margin-bottom: 20px; }
.widget-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-muted);
  margin: 0 0 10px;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 20px 0 28px;
  background: var(--color-bg-alt);
}

.site-footer .site-info {
  font-size: 12px;
  color: var(--color-muted);
  text-align: center;
}

/* ==========================================================================
   7b. MENU INFERIOR (mobile: lista vertical centralizada / desktop: linha)
   ========================================================================== */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav__list {
  list-style: none;
  margin: 0;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bottom-nav__list li { display: flex; min-width: 0; }

.bottom-nav__list a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-muted);
  padding: 3px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-nav__list li.current-menu-item a,
.bottom-nav__list li.current_page_item a,
.bottom-nav__list a:hover {
  color: var(--color-primary);
}

/* Em posts e páginas o menu inferior não fica fixo: aparece no fim do
   conteúdo, como um rodapé normal, sem flutuar durante a rolagem. */
body.single .bottom-nav,
body.page .bottom-nav {
  position: static;
}
body.single,
body.page {
  padding-bottom: 0;
}
body.single .cookie-notice,
body.page .cookie-notice {
  bottom: 0;
}

/* No mobile, na home, o menu inferior também não fica mais fixo: some
   flutuar e passa a aparecer no final da página (depois do feed de posts). */
body.home .bottom-nav {
  position: static;
}
body.home {
  padding-bottom: 0;
}
body.home .cookie-notice {
  bottom: 0;
}

/* ==========================================================================
   7c. AVISO DE COOKIES (fixo, acima do menu inferior no mobile)
   ========================================================================== */

.cookie-notice {
  /* escondido por padrão: o JS decide se mostra, depois de checar o cookie
     no navegador — assim funciona certo mesmo com cache de página ativado. */
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-height);
  z-index: 110;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  flex-direction: column;
  gap: 10px;
}

.cookie-notice.is-visible { display: flex; }

.cookie-notice__text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.cookie-notice__text a {
  color: var(--color-accent);
  text-decoration: underline;
}

.cookie-notice .btn-cookie-ok {
  align-self: flex-end;
  background: var(--color-accent);
  color: #1c1c1c;
  border: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: var(--radius);
  cursor: pointer;
}

.cookie-notice .btn-cookie-ok:hover { background: var(--color-accent-hover); }

/* ==========================================================================
   8. PAGINAÇÃO / FORM BUSCA / 404
   ========================================================================== */

.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  font-size: 13px;
}
.pagination a, .pagination span {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.search-form { display: flex; gap: 8px; margin-bottom: 16px; }
.search-form input[type="search"] {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
}
.search-form button {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.error-404 { text-align: center; padding: 40px 0; }

/* ==========================================================================
   9. DESKTOP (min-width 782px) - ajustes discretos, mantendo minimalismo
   ========================================================================== */

@media (min-width: 782px) {
  :root {
    --container-width: 900px;
    --header-height: 64px;
    /* No desktop o menu inferior volta a ser uma linha única e baixa
       (o empilhamento vertical é só recurso de mobile). */
    --bottom-nav-height: 56px;
  }

  /* Menu inferior também aparece no desktop, centralizado, em linha (não
     empilhado como no mobile) e mais espaçado entre os itens. */
  .bottom-nav__list {
    flex-direction: row;
    max-width: var(--container-width);
    margin: 0 auto;
    justify-content: center;
    gap: 32px;
    padding: 0 16px;
  }
  .bottom-nav__list a { padding: 18px 4px; }

  /* No desktop a home volta a ter o menu inferior fixo (a mudança para
     estático/fim-de-página é só para o mobile). */
  body.home .bottom-nav {
    position: fixed;
  }
  body.home {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  }
  body.home .cookie-notice {
    bottom: var(--bottom-nav-height);
  }

  .cookie-notice {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    gap: 20px;
  }
  .cookie-notice .btn-cookie-ok { align-self: auto; flex-shrink: 0; }

  .menu-toggle { display: none; }

  /* Logo + menu centralizados juntos, como um único grupo, em vez de
     espalhados nas pontas do cabeçalho. */
  .site-header .container {
    justify-content: center;
    gap: 40px;
  }

  .primary-navigation {
    display: block;
    position: static;
    background: none;
    border: none;
  }

  .primary-navigation ul {
    display: flex;
    gap: 20px;
    padding: 0;
  }

  .primary-navigation li { border-bottom: none; }
  .primary-navigation a { padding: 4px 0; font-size: 14px; }

  .site-branding img.custom-logo { max-height: 32px; }
  .site-branding .site-title-text { font-size: 17px; }

  .page-hero { padding: 24px 0 16px; }
  .page-hero__title { font-size: 1.6rem; }

  .entry-title { font-size: 1.25rem; }

  .content-area--feed .entry-thumbnail {
    margin: 0 0 12px;
    border-radius: var(--radius);
  }

  /* Sidebar ao lado do conteúdo (posts, arquivos, 404) — no mobile continua
     empilhada abaixo, como já era. */
  .content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 40px;
  }
  .content-wrapper .content-area {
    flex: 1;
    min-width: 0;
  }
  .content-wrapper .widget-area {
    width: 280px;
    flex-shrink: 0;
    margin-top: 0;
    /* Acompanha a rolagem: fica "grudada" logo abaixo do menu superior
       fixo, e para sozinha quando chega ao fim do conteúdo ao lado. */
    position: sticky;
    top: calc(var(--header-height) + 20px);
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
  }
}

@media (min-width: 1024px) {
  :root { --container-width: 980px; }
}
