/* Header CSS - Isolado e específico */



/* Adicione este código ao seu arquivo CSS */

/* 1. Transforma o link da marca em um container flexível */
.brand-link {
    display: flex;
    align-items: center; /* Alinha o logo e o texto verticalmente ao centro */
    gap: 0.75rem;        /* Cria um espaço de 12px entre o logo e o texto */
    text-decoration: none; /* Remove o sublinhado padrão do link */
    color: inherit;      /* Faz o texto herdar a cor do elemento pai */
}

/* 2. Regra principal para controlar o tamanho do logo */
.brand-logo {
    max-height: 44px; /* Define a altura máxima do logo. Você pode ajustar este valor (ex: 36px) */
    border-radius: 50px;
    width: auto;      /* Garante que a largura se ajuste para manter a proporção */
    object-fit: contain; /* Garante que a imagem escale corretamente sem ser cortada */
}

/* 3. Estilo para o título do site (ajuste opcional) */
.brand-title {
    font-size: 1.5rem; /* Tamanho da fonte (24px) */
    font-weight: 600;  /* Peso da fonte */
    margin: 0;         /* Remove qualquer margem padrão do h1 */
    line-height: 1;    /* Garante que a altura da linha não adicione espaço extra */
}




/* ============================================ */
/* 1. ESTADO PADRÃO (SÓLIDO) PARA TODAS AS PÁGINAS */
/* ============================================ */
.site-header {
    width: 100%;
    position: sticky; /* Padrão 'sticky' para páginas internas */
    top: 0;
    left: 0;
    z-index: 1000;
    background: var(--bg-card-optimized);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 20px var(--shadow-color);
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.header-nav { width: 100%; }
.header-content { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; gap: 1.5rem; }
.header-brand { flex-shrink: 0; }
.brand-link { text-decoration: none; }
.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-heading); /* Cor padrão do tema */
    margin: 0;
    transition: color 0.4s ease;
}

.header-navigation { display: none; flex-grow: 1; }
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; margin: 0; padding: 0; }
.nav-link {
    font-weight: 500;
    color: var(--text-primary); /* Cor padrão do tema */
    text-decoration: none;
    transition: color 0.3s ease, border-color 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--color-accent); border-bottom-color: var(--color-accent); }

.header-search { display: none; flex-shrink: 0; max-width: 280px; width: 100%; }
.search-form { width: 100%; margin: 0; }
.search-input-wrapper {
    position: relative; display: flex; align-items: center; background: var(--bg-section-2);
    border: 1px solid var(--border-color); border-radius: 50px; overflow: hidden;
    transition: all 0.4s ease; height: 44px;
}
.search-input {
    flex: 1; background: transparent; border: none; outline: none; padding: 0.75rem 1rem;
    font-size: 0.9rem; color: var(--text-primary); font-family: inherit;
}
.search-input::placeholder { color: var(--text-secondary); }

.header-theme-selector { position: relative; display: none; }
.theme-selector-btn {
    display: flex; align-items: center; gap: 0.5rem; background: var(--bg-section-2);
    border: 1px solid var(--border-color); border-radius: 50px; padding: 0.4rem 0.5rem 0.4rem 1rem;
    cursor: pointer; transition: all 0.4s ease; height: 44px; color: var(--text-primary); white-space: nowrap;
}
.theme-selector-btn i { font-size: 0.7rem; color: var(--text-secondary); transition: transform 0.3s ease; }

.hamburger-line { width: 24px; height: 2px; background: var(--text-primary); transition: all 0.4s ease; border-radius: 2px; }

.search-button { background: var(--color-accent); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: opacity 0.2s ease, transform 0.2s ease; margin-right: -1px; }
.mobile-menu-toggle { display: flex; flex-direction: column; justify-content: center; align-items: center; background: none; border: none; cursor: pointer; padding: 0.5rem; gap: 4px; transition: transform 0.3s ease; z-index: 1001; }
.mobile-navigation { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card-optimized); border-bottom: 1px solid var(--border-color); box-shadow: 0 10px 30px var(--shadow-color); }
.current-theme-indicator { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--bg-card-optimized); flex-shrink: 0; }

/* ============================================ */
/* 2. COMPORTAMENTO ESPECIAL PARA A HOMEPAGE     */
/* ============================================ */

body.is-homepage .site-header {
    position: fixed;
    background: transparent;
    border-bottom-color: transparent;
    box-shadow: none;
}
body.is-homepage .brand-title,
body.is-homepage .nav-link {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
body.is-homepage .nav-link:hover {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
}
body.is-homepage .hamburger-line {
    background: #ffffff;
}
body.is-homepage .search-input-wrapper {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}
body.is-homepage .search-input {
    color: #ffffff;
}
body.is-homepage .search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}
body.is-homepage .theme-selector-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
}
body.is-homepage .theme-selector-btn i {
    color: rgba(255, 255, 255, 0.7);
}
body.is-homepage .current-theme-indicator {
    border-color: transparent;
}

/* ============================================ */
/* 3. ESTADO DE SCROLL (SÓ IMPORTA NA HOMEPAGE) */
/* ============================================ */

body.is-homepage .site-header.scrolled-header {
    background: var(--bg-card-optimized);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 20px var(--shadow-color);
}
body.is-homepage .scrolled-header .brand-title {
    color: var(--text-heading);
    text-shadow: none;
}
body.is-homepage .scrolled-header .nav-link {
    color: var(--text-primary);
    text-shadow: none;
}
body.is-homepage .scrolled-header .nav-link:hover {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}
body.is-homepage .scrolled-header .hamburger-line {
    background: var(--text-primary);
}
body.is-homepage .scrolled-header .search-input-wrapper {
    background: var(--bg-section-2);
    border-color: var(--border-color);
}
body.is-homepage .scrolled-header .search-input {
    color: var(--text-primary);
}
body.is-homepage .scrolled-header .search-input::placeholder {
    color: var(--text-secondary);
}
body.is-homepage .scrolled-header .theme-selector-btn {
    background: var(--bg-section-2);
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.is-homepage .scrolled-header .theme-selector-btn i {
    color: var(--text-secondary);
}
body.is-homepage .scrolled-header .current-theme-indicator {
    border-color: var(--bg-card-optimized);
}

/* ============================================ */
/* 4. REGRAS DE EXIBIÇÃO E OUTROS ESTILOS       */
/* ============================================ */
.theme-selector-btn:hover { border-color: var(--color-accent); background: var(--bg-section-1); }
.header-theme-selector.active .theme-selector-btn i { transform: rotate(180deg); }
.current-theme { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; font-weight: 500; }
.theme-selector { display: none; position: absolute; top: calc(100% + 10px); right: 0; min-width: 200px; background: var(--bg-card-optimized); border: 1px solid var(--border-color); border-radius: 0.75rem; box-shadow: 0 8px 30px var(--shadow-color); padding: 0.5rem; z-index: 1010; }
.header-theme-selector.active .theme-selector { display: block; animation: slideDown 0.2s ease-out forwards; }
.theme-option { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.75rem 1rem; border-radius: 0.5rem; cursor: pointer; font-weight: 500; transition: background-color 0.2s ease, color 0.2s ease; color: var(--text-primary); background-color: transparent; border: none; text-align: left; font-size: 0.9rem; }
.theme-option:hover, .theme-option:focus { background-color: var(--bg-section-2); color: var(--text-heading); outline: none; }
.theme-option.active { color: var(--color-accent); font-weight: 600; }
.theme-indicator { width: 1rem; height: 1rem; border-radius: 50%; flex-shrink: 0; }
.mobile-menu-toggle:hover { transform: scale(1.1); }
.mobile-menu-toggle.active .hamburger-line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-menu-toggle.active .hamburger-line:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active .hamburger-line:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }
.mobile-navigation.active { display: block; animation: slideDown 0.3s ease-out; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.mobile-nav-content { padding: 1.5rem; }
.mobile-search { margin-bottom: 1.5rem; }
.mobile-search-form { display: flex; gap: 0.5rem; }
.mobile-search-input { flex: 1; padding: 0.75rem 1rem; background: var(--bg-section-2); border: 1px solid var(--border-color); border-radius: 0.5rem; color: var(--text-primary); font-family: inherit; }
.mobile-search-button { background: var(--color-accent); border: none; color: white; padding: 0.75rem 1rem; border-radius: 0.5rem; cursor: pointer; transition: opacity 0.2s ease; }
.mobile-nav-links { list-style: none; margin: 0; padding: 0; }
.mobile-nav-links li { border-bottom: 1px solid var(--border-color); }
.mobile-nav-links li:last-child { border-bottom: none; }
.mobile-nav-link { display: block; padding: 1rem 0; color: var(--text-primary); text-decoration: none; font-weight: 500; transition: color 0.2s ease; }
.mobile-nav-link:hover { color: var(--color-accent); }
.mobile-theme-selector { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); }
.mobile-theme-title { font-weight: 600; color: var(--text-heading); margin-bottom: 1rem; font-size: 1rem; text-align: left; }
.mobile-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 0.75rem; }
.mobile-theme-grid .theme-option { justify-content: center; padding: 0.5rem; height: 44px; width: 44px; border: 2px solid transparent; border-radius: 50%; transition: border-color 0.2s ease; }
.mobile-theme-grid .theme-option.active { border-color: var(--color-accent); }
.mobile-theme-grid .theme-option .theme-indicator { width: 100%; height: 100%; }

/* Desktop Styles - REESTRUTURADO PARA MELHOR RESPONSIVIDADE */
/* Tablet (e telas pequenas de desktop) */
@media (min-width: 768px) { 
    .header-navigation,
    .header-theme-selector,
    .header-search { 
        display: block;
    } 
    .header-search {
        display: flex;
        /* CORREÇÃO: Barra de busca menor para caber em tablets */
        max-width: 180px;
    }
    .nav-links {
        /* CORREÇÃO: Espaçamento menor entre os links em tablets */
        gap: 1.5rem;
    }
    .mobile-menu-toggle { 
        display: none; 
    } 
}

/* Desktop (telas maiores) */
@media (min-width: 1024px) { 
    .header-content { 
        justify-content: initial; 
        gap: 3rem; 
    } 
    .header-search { 
        /* Retorna ao tamanho maior na versão desktop */
        max-width: 320px; 
        margin-left: auto; 
    } 
    .header-theme-selector { 
        margin-left: 0; 
    } 
    .nav-links { 
        /* Retorna ao espaçamento maior na versão desktop */
        gap: 2.5rem; 
    } 
}

/* ================================================== */
/* 5. BARRA DE PROGRESSO DE LEITURA (NOVO CÓDIGO)     */
/* ================================================== */
.reading-progress-bar {
    position: absolute;
    bottom: -1px; /* Posiciona sobre a borda inferior do header */
    left: 0;
    width: 100%;
    height: 3px; /* Altura da barra */
    background: transparent;
    z-index: 1; /* Garante que fique acima do conteúdo da página, mas abaixo de menus */
    pointer-events: none; /* Impede que a barra intercepte cliques */
}

.progress-fill {
    width: 0; /* Inicia com largura 0 */
    height: 100%;
    background: var(--color-accent);
    border-radius: 0 1px 1px 0;
    transition: width 0.1s linear; /* Animação suave */
}