/*
Theme Name: NGF Performance Pro
Theme URI: https://ngfcontabilidade.com.br
Description: Tema de alta performance. Logo reduzida, slogan lateral e submenus vermelhos.
Author: NGF Team
Version: 1.8
Text Domain: ngf-pro
*/

/* ── TOKENS ──────────────────────────────────────────────────── */
:root {
    --vermelho-ngf: #d7393e;
    --laranja-ngf:  #ffb546;
    --branco:       #ffffff;
    --preto:        #1a1a1a;
    --cinza-footer: #24292e;
    --z-header:     1000;
}

/* ── RESET MÍNIMO ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--preto);
    margin: 0;
    line-height: 1.6;
    /* NÃO colocar overflow-x: hidden aqui.
       overflow-x no body/html quebra position: sticky em Safari iOS —
       o header deixa de grudar no topo em todos os iPhones e iPads.
       O controle de overflow horizontal é feito no #page abaixo. */
}

/* FIX: overflow-x aplicado no wrapper #page, nunca no body.
   Isso previne scroll horizontal causado pelo menu mobile absolute
   sem afetar o comportamento de sticky do header em nenhum browser. */
#page {
    overflow-x: hidden;
}

/* ── LAYOUT ──────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── ACESSIBILIDADE ──────────────────────────────────────────── */
/* Oculto visualmente; aparece ao receber foco de teclado (WCAG 2.4.1).
   z-index acima do header garante que nunca fique escondido por ele. */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--vermelho-ngf);
    color: var(--branco);
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    z-index: calc(var(--z-header) + 1);
    transition: top .2s ease;
}
.skip-to-content:focus { top: 0; }

/* ── HEADER ──────────────────────────────────────────────────── */
.site-header {
    background: var(--branco);
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
}

.header-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── BRANDING ────────────────────────────────────────────────── */
.branding-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* width + height explícitos reservam espaço antes da imagem carregar,
   prevenindo CLS (Cumulative Layout Shift) — fator de ranking no Google.
   object-fit: contain garante que a logo nunca seja distorcida. */
.logo img {
    width: 108px;
    height: 50px;
    display: block;
    object-fit: contain;
}

.branding-text {
    display: flex;
    flex-direction: column;
    border-left: 1px solid #ddd;
    padding-left: 15px;
    line-height: 1.2;
}

.branding-text .line-1 {
    font-weight: 700;
    font-size: 13px;
    color: var(--vermelho-ngf);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 12px é o mínimo recomendado pelo Google Mobile-Friendly Test.
   Texto abaixo de 12px é penalizado como ilegível em mobile. */
.branding-text .line-2 {
    font-size: 12px;
    color: #666;
}

/* ── MENU DESKTOP ────────────────────────────────────────────── */
.main-navigation ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.main-navigation li { position: relative; }

.main-navigation a {
    text-decoration: none;
    color: var(--preto);
    font-weight: 600;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    transition: color .2s ease;
}

.main-navigation > ul > li > a:hover { color: var(--vermelho-ngf); }

.menu-item-has-children > a::after {
    content: '▾';
    margin-left: 5px;
    font-size: 10px;
}

/* ── SUBMENU ─────────────────────────────────────────────────── */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--vermelho-ngf);
    min-width: 240px;
    flex-direction: column;
    padding: 10px 0;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,.15);
}

.main-navigation ul ul a {
    color: var(--branco);
    padding: 10px 20px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    transition: background .2s ease;
}

.main-navigation ul ul li:last-child > a { border-bottom: none; }

.main-navigation ul ul a:hover { background: rgba(0,0,0,.15); }

.main-navigation li:hover > ul { display: flex; }

/* ── MOBILE ──────────────────────────────────────────────────── */
.menu-toggle {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--preto);
    border-radius: 2px;
}

#menu-checkbox { display: none; }

@media (max-width: 960px) {
    .branding-text { display: none; }

    .menu-toggle { display: flex; }

    .main-navigation {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--branco);
        box-shadow: 0 4px 10px rgba(0,0,0,.1);
    }

    #menu-checkbox:checked ~ .main-navigation { display: block; }

    .main-navigation ul { flex-direction: column; }

    .main-navigation ul ul {
        position: static;
        display: none;
        border-radius: 0;
        box-shadow: none;
    }

    .main-navigation li.open > ul { display: block; }
}

/* ── CONTEÚDO SINGULAR ───────────────────────────────────────── */
.entry-title {
    font-size: 28px;
    line-height: 1.3;
    margin-bottom: 20px;
    color: var(--preto);
}

.entry-content {
    font-size: 16px;
    line-height: 1.8;
}

/* ── BLOG — CARDS ────────────────────────────────────────────── */
.blog-post-card {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid #eee;
}

.blog-post-card:last-of-type { border-bottom: none; }

.post-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 16px;
    border-radius: 6px;
}

.entry-footer { margin-top: 16px; }

.read-more {
    display: inline-block;
    color: var(--vermelho-ngf);
    font-weight: 600;
    text-decoration: none;
    transition: opacity .2s ease;
}

.read-more:hover { opacity: .75; }

/* ── NÃO ENCONTRADO ──────────────────────────────────────────── */
.not-found {
    padding: 60px 0;
    text-align: center;
}

.not-found h1 {
    font-size: 28px;
    color: var(--preto);
    margin-bottom: 12px;
}

.not-found p {
    color: #666;
    margin-bottom: 24px;
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.footer-top {
    background: var(--cinza-footer);
    color: var(--branco);
    padding: 50px 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-top a {
    color: var(--branco);
    text-decoration: none;
    transition: color .2s ease;
}

.footer-top a:hover { color: var(--laranja-ngf); }

.footer-bottom {
    background: #1c2126;
    color: #999;
    padding: 20px 0;
    text-align: center;
}

/* Estilo do link de copyright — definido aqui para evitar
   style="" inline no PHP, que aumenta o HTML gerado. */
.footer-copyright-link {
    color: inherit;
    text-decoration: none;
    transition: opacity .2s ease;
}

/* FIX: feedback visual no hover — todos os outros links do site
   têm hover; ausência aqui seria inconsistente para o usuário. */
.footer-copyright-link:hover { opacity: .75; }

/* ── BREADCRUMB ──────────────────────────────────────────────── */
.breadcrumb {
    margin-bottom: 24px;
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: #888;
}

.breadcrumb-item a {
    color: #888;
    text-decoration: none;
    transition: color .2s ease;
}

.breadcrumb-item a:hover { color: var(--vermelho-ngf); }

.breadcrumb-item--current {
    color: var(--preto);
    font-weight: 500;
    /* Limita o título longo para não quebrar o layout em mobile */
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-sep {
    color: #ccc;
    font-size: 12px;
    margin: 0 2px;
}

/* ── SINGLE POST ─────────────────────────────────────────────── */

/* Imagem destacada do post — largura total, proporção 16:9 preservada */
.single-post__thumbnail {
    margin-bottom: 32px;
    border-radius: 8px;
    overflow: hidden;
    /* aspect-ratio reserva o espaço antes da imagem carregar — anti-CLS */
    aspect-ratio: 16 / 9;
    background: #f4f4f4;
}

.single-post__img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.single-post__header { margin-bottom: 32px; }

/* Categorias acima do título */
.entry-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.entry-category-link {
    display: inline-block;
    background: var(--vermelho-ngf);
    color: var(--branco);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    transition: opacity .2s ease;
}

.entry-category-link:hover { opacity: .8; }

/* Meta do post: autor · data · atualização */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #777;
    margin-top: 12px;
}

.post-meta__author-link {
    color: var(--vermelho-ngf);
    text-decoration: none;
    font-weight: 600;
    transition: opacity .2s ease;
}

.post-meta__author-link:hover { opacity: .75; }

.post-meta__sep {
    color: #ccc;
    font-size: 16px;
}

.post-meta__date,
.post-meta__updated { color: #888; }

/* Tags no rodapé do post */
.single-post__footer {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.entry-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.entry-tags__label {
    color: #888;
    font-weight: 600;
}

.entry-tag-link {
    display: inline-block;
    background: #f4f4f4;
    color: var(--preto);
    font-size: 12px;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    transition: background .2s ease, border-color .2s ease;
}

.entry-tag-link:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

/* Navegação anterior / próximo */
.post-navigation {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid #eee;
}

.nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.nav-previous,
.nav-next {
    display: flex;
}

.nav-next { justify-content: flex-end; }

.nav-links a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    max-width: 300px;
    transition: opacity .2s ease;
}

.nav-links a:hover { opacity: .75; }

.post-navigation__label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.post-navigation__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--preto);
    line-height: 1.4;
}

@media (max-width: 600px) {
    .nav-links {
        grid-template-columns: 1fr;
    }
    .nav-next { justify-content: flex-start; }
}

/* ── PAGE CONTENT (page.php) ─────────────────────────────────── */
.page-content__thumbnail {
    margin-bottom: 32px;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #f4f4f4;
}

.page-content__img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.page-content__header { margin-bottom: 24px; }

.page-content__body {
    font-size: 16px;
    line-height: 1.8;
}

/* Espaçamento responsivo em mobile para single e page */
@media (max-width: 600px) {
    .single-post__thumbnail,
    .page-content__thumbnail {
        border-radius: 4px;
        margin-bottom: 20px;
    }

    .single-post__header { margin-bottom: 20px; }

    .post-meta { gap: 6px; font-size: 13px; }

    .breadcrumb-item--current { max-width: 160px; }
}
