/*
 Theme Name: ScienceLab
 Theme URI: https://www.ufv.br
 Author: Laboratório de Bioinformática e Genômica - UFV CRP
 Author URI: https://www.ufv.br
 Description: Tema acadêmico moderno com suporte a largura total fluida e barra lateral responsiva.
 Version: 3.3
 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: sciencelab
 Tags: news, education, custom-menu, featured-images, full-width-template, theme-options, translation-ready
 */

/* --------------------------------------------------
 * 1. VARIÁVEIS NATIVAS & RESET
 * -------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  /* Cores Principais */
  --primary-color: #682a2c;
  --primary-hover: #4a1e20;
  --secondary-color: rgba(104, 42, 44, 0.4);
  --tertiary-color: rgba(104, 42, 44, 0.08);
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-main: #2d3748;
  --text-muted: #64748b;
  --accent-gold: #D97706;

  /* Design System */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 30px -10px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Dimensões do Layout Fluido */
  --site-padding: 0 3vw;
  --sidebar-width: 320px;
  --grid-gap: 32px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover,
a:focus {
  color: var(--primary-hover);
}

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

/* Helper de Acessibilidade */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* --------------------------------------------------
 * 2. ESTRUTURA BASE DE LARGURA TOTAL
 * -------------------------------------------------- */
.header-container,
.nav-container,
.content-wrapper,
.content-area,
.footer-container {
  width: 100%;
  max-width: 100%;
  padding: var(--site-padding);
  margin-left: auto;
  margin-right: auto;
}

/* Layout Principal com Barra Lateral */
.content-wrapper,
.content-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: var(--grid-gap);
  margin-top: 35px;
  margin-bottom: 50px;
}

main.site-main {
  min-width: 0;
}

/* --------------------------------------------------
 * 3. CABEÇALHO DO SITE (BRANDING & BUSCA - COR #682a2c)
 * -------------------------------------------------- */
.site-header {
  background-color: #682a2c;
  color: #ffffff;
  padding: 0;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 100;
}

.header-top {
  padding: 18px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.header-top .header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 16px;
}

.custom-logo {
  max-height: 80px;
  width: auto;
  object-fit: contain;
}

/* Título e Descrição Aumentados */
.site-title {
  margin: 0;
  font-family: 'Lora', serif;
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
}

.site-title a {
  color: #ffffff;
}

.site-title a:hover {
  color: #fde68a;
}

.site-description {
  margin: 4px 0 0;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 400;
}

/* Ações e Busca no Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search .search-form {
  display: flex;
  align-items: center;
  margin: 0;
}

.header-search .search-field {
  height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  outline: none;
  width: 160px;
  background-color: rgba(255, 255, 255, 0.95);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.header-search .search-field:focus {
  width: 200px;
  background-color: #ffffff;
}

.header-search .search-submit {
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-left: none;
  background-color: #ffffff;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  transition: var(--transition);
}

.header-search .search-submit:hover {
  background-color: #fde68a;
}

.btn-header {
  display: inline-block;
  padding: 8px 16px;
  background: #ffffff;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: var(--transition);
}

.btn-header:hover {
  background: #fde68a;
  color: var(--primary-hover);
}

/* --------------------------------------------------
 * 4. NAVEGAÇÃO PRINCIPAL (DESKTOP)
 * -------------------------------------------------- */
.main-navigation {
  background-color: transparent;
  padding: 8px 0;
}

.main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.main-navigation li a {
  display: block;
  padding: 8px 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.main-navigation li a:hover,
.main-navigation li.current-menu-item > a {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.2);
}

/* Botão do Menu Mobile (Escondido no Desktop) */
.menu-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px auto;
  width: 100%;
  max-width: 280px;
  transition: var(--transition);
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Ícone Hambúrguer em CSS */
.menu-toggle-icon {
  display: inline-block;
  width: 20px;
  height: 2px;
  background: #ffffff;
  position: relative;
  transition: background 0.2s ease-in-out;
}

.menu-toggle-icon::before,
.menu-toggle-icon::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background: #ffffff;
  left: 0;
  transition: all 0.2s ease-in-out;
}

.menu-toggle-icon::before { top: -6px; }
.menu-toggle-icon::after { top: 6px; }

/* Animação do ícone ao abrir */
.menu-toggle[aria-expanded="true"] .menu-toggle-icon {
  background: transparent;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-icon::before {
  transform: rotate(45deg);
  top: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-icon::after {
  transform: rotate(-45deg);
  top: 0;
}

/* --------------------------------------------------
 * 5. POSTS, CARDS E GRELHAS
 * -------------------------------------------------- */
.post-destaque {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  border: 1px solid #f1f5f9;
}

.post-destaque img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.card-post {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
  transition: var(--transition);
}

.card-post:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-post img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Metadados dos Posts */
.entry-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.meta-category {
  background: var(--tertiary-color);
  color: var(--primary-color);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* --------------------------------------------------
 * 6. BARRA LATERAL & WIDGETS
 * -------------------------------------------------- */
.sidebar .widget,
.widget-area .widget {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
}

.sidebar .widget-title,
.widget-area .widget-title {
  font-family: 'Lora', serif;
  font-size: 1.15rem;
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tertiary-color);
}

.sidebar ul,
.widget-area ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li a,
.widget-area li a {
  display: block;
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
}

.sidebar li a:hover,
.widget-area li a:hover {
  background: var(--primary-color);
  color: #ffffff;
}

/* --------------------------------------------------
 * 7. PÁGINAS E ARTIGOS INDIVIDUAIS (SINGLE)
 * -------------------------------------------------- */
article.type-post,
article.type-page,
.page-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
}

.entry-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.alignwide { max-width: 100%; }
.alignfull { width: 100%; max-width: 100%; }

/* --------------------------------------------------
 * 8. RODAPÉ (FOOTER - MESMA COR #682a2c DO HEADER)
 * -------------------------------------------------- */
.site-footer {
  background-color: #682a2c;
  color: rgba(255, 255, 255, 0.9);
  padding: 30px 0;
  margin-top: 60px;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.site-footer .footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer .site-info p {
  margin: 0;
}

.site-footer a {
  color: #ffffff;
  font-weight: 500;
  transition: var(--transition);
}

.site-footer a:hover {
  color: #fde68a;
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.back-to-top:hover {
  background: #ffffff;
  color: #682a2c;
}

/* --------------------------------------------------
 * 9. RESPONSIVIDADE E ADAPTAÇÃO MOBILE (< 992px e < 768px)
 * -------------------------------------------------- */
@media (max-width: 992px) {
  .content-wrapper,
  .content-area {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Header Topo */
  .header-top {
    padding: 14px 0;
  }

  .header-top .header-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .site-branding {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .custom-logo {
    max-height: 65px;
  }

  .site-title {
    font-size: 1.5rem;
  }

  .site-description {
    font-size: 0.9rem;
  }

  /* Área de Ações e Pesquisa no Mobile */
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .header-search {
    width: 100%;
    max-width: 320px;
  }

  .header-search .search-form {
    width: 100%;
  }

  .header-search .search-field {
    width: 100% !important;
    flex-grow: 1;
  }

  .btn-header {
    width: 100%;
    max-width: 320px;
    text-align: center;
  }

  /* Exibir Botão de Toggle do Menu */
  .menu-toggle {
    display: flex;
  }

  /* Menu Dobrável / Sanfona */
  .main-navigation {
    padding: 0;
  }

  .main-navigation ul {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    padding: 12px 0;
    margin-top: 8px;
    border-radius: var(--radius-sm);
    gap: 4px;
  }

  /* Forçar a exibição do menu quando ativo */
  .main-navigation.nav-open ul,
  .main-navigation.toggled ul {
    display: flex !important;
  }

  .main-navigation li {
    width: 100%;
    text-align: center;
  }

  .main-navigation li a {
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 0;
  }

  /* Ajustes de Conteúdo e Posts no Mobile */
  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-destaque img {
    height: 250px;
  }

  article.type-post,
  article.type-page,
  .page-card {
    padding: 20px 16px;
  }

  .site-footer .footer-container {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}
/* --------------------------------------------------
 * REGRAS DE CSS PARA OS LAYOUTS DINÂMICOS
 * -------------------------------------------------- */

/* Layout 3: Minimalista (Sem Barra Lateral e Grade de 3 Colunas) */
.layout-minimalist {
  grid-template-columns: 1fr !important;
}

.category-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

.filter-label {
  font-weight: 600;
  color: var(--text-muted);
}

.filter-btn {
  padding: 6px 14px;
  background: #e2e8f0;
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--primary-color);
  color: #ffffff;
}

.posts-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Layout 2: Portal (Posts Horizontais & Blocos de Categoria) */
.section-title {
  font-family: 'Lora', serif;
  color: var(--primary-color);
  border-bottom: 2px solid var(--tertiary-color);
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.card-post-horizontal {
  display: flex;
  gap: 20px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid #f1f5f9;
}

.card-post-horizontal .post-thumb {
  width: 200px;
  flex-shrink: 0;
}

.card-post-horizontal .post-thumb img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.category-block {
  margin-top: 40px;
}

.category-block-title {
  font-family: 'Lora', serif;
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-bottom: 16px;
}

/* Adaptação Responsiva dos Novos Layouts */
@media (max-width: 992px) {
  .posts-grid-3col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .posts-grid-3col {
    grid-template-columns: 1fr;
  }
  .card-post-horizontal {
    flex-direction: column;
  }
  .card-post-horizontal .post-thumb {
    width: 100%;
  }
}
