/* ============================================================
   TERREIRA PAULINHO APP — estudos.css
   Estilos exclusivos para a Plataforma de E-Learning Espiritual (Focus Mode)
   Respeita rigorosamente a paleta de cores:
   Marfim (#FCFAF8), Carmim (#8B1C1C), Terracota (#A65D37), Café (#2B1D14)
   ============================================================ */

/* ===== HERO DA ÁREA DE ESTUDOS ===== */
.estudos-hero {
  position: relative;
  padding: 9rem 0 5rem 0;
  text-align: center;
  overflow: hidden;
  background: 
    radial-gradient(ellipse at top, rgba(166, 93, 55, 0.1) 0%, transparent 60%),
    linear-gradient(180deg, #F5F0EB 0%, #FCFAF8 100%);
  border-bottom: 1px solid rgba(166, 93, 55, 0.1);
}

.estudos-hero-content {
  position: relative;
  z-index: 2;
  max-width: 850px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.estudos-hero-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--gold); /* Carmim */
  margin-bottom: 0.8rem;
  letter-spacing: 0.02em;
}

.estudos-hero-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin: 1rem auto;
  max-width: 200px;
}

.estudos-hero-divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--wine), transparent);
}

.estudos-hero-divider .symbol {
  font-size: 0.8rem;
  color: var(--wine);
  opacity: 0.8;
}

.estudos-hero-subtitle {
  font-family: 'Lato', sans-serif;
  font-size: 1.1rem;
  color: var(--text-secondary); /* Café Médio */
  line-height: 1.8;
  font-weight: 300;
}

/* ===== LAYOUT MASTER/DETAIL ===== */
.livro-secao {
  background-color: var(--bg-base);
  padding: 3rem 0 7rem 0;
  position: relative;
}

.livro-grid {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 3.5rem;
  align-items: start;
}

/* ===== SIDEBAR DE NAVEGAÇÃO DOS MÓDULOS (MASTER) ===== */
.livro-sidebar {
  position: sticky;
  top: 90px;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  box-shadow: var(--shadow-card);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(166, 93, 55, 0.2) transparent;
}

.livro-sidebar::-webkit-scrollbar {
  width: 5px;
}
.livro-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(166, 93, 55, 0.2);
  border-radius: 10px;
}

.sidebar-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed rgba(166, 93, 55, 0.2);
}

.btn-close-sidebar {
  display: none; /* Apenas no mobile */
}

/* Módulos Expansíveis */
.modulo-item {
  border-bottom: 1px solid rgba(166, 93, 55, 0.1);
  padding: 0.8rem 0;
}
.modulo-item:last-child {
  border-bottom: none;
}

.modulo-trigger {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.2rem;
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  outline: none;
}

.modulo-trigger:hover {
  color: var(--wine);
}

.modulo-num {
  font-size: 0.75rem;
  color: var(--wine);
  margin-right: 0.4rem;
  border: 1px solid rgba(166, 93, 55, 0.25);
  padding: 2px 5px;
  border-radius: 4px;
}

.modulo-chevron {
  font-size: 0.7rem;
  transition: transform 0.38s ease;
  color: var(--text-muted);
}

/* Estado Aberto do Módulo */
.modulo-conteudo {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0 0.6rem 0.5rem;
  animation: slideDownStudy 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.modulo-item.open .modulo-conteudo {
  display: flex;
}

.modulo-item.open .modulo-chevron {
  transform: rotate(180deg);
  color: var(--wine);
}

@keyframes slideDownStudy {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sub-título interno na Sidebar */
.modulo-subtitulo-sec {
  font-family: 'Lato', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.6rem 0.2rem 0.6rem;
  margin-top: 0.3rem;
  border-top: 1px dashed rgba(166, 93, 55, 0.08);
}
.modulo-subtitulo-sec:first-of-type {
  border-top: none;
  margin-top: 0;
}

/* Botões de Tópicos */
.topico-btn {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 0.8rem;
  font-family: 'Lato', sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.topico-btn:hover {
  background: rgba(166, 93, 55, 0.05);
  color: var(--wine);
  transform: translateX(3px);
}

.topico-btn.active {
  background: var(--gold-muted);
  color: var(--gold);
  border-color: rgba(139, 28, 28, 0.12);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold);
}

/* ===== ÁREA DE LEITURA (GLASSMORPHISM) ===== */
.livro-leitura {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: 3.5rem;
  box-shadow: 
    0 30px 70px rgba(166, 93, 55, 0.08), 
    0 1px 3px rgba(43, 29, 20, 0.03),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  min-height: 600px;
}

/* Palco de leitura dinâmico com animação */
.leitura-palco-wrap {
  opacity: 1;
  transition: opacity 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.leitura-palco-wrap.fade-out {
  opacity: 0;
}

.capitulo-header {
  margin-bottom: 2.2rem;
  border-bottom: 1px dashed rgba(166, 93, 55, 0.2);
  padding-bottom: 1.5rem;
}

.capitulo-tag {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--wine);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.5rem;
}

.capitulo-titulo {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.3rem);
  color: var(--text-primary);
  line-height: 1.3;
}

/* Imagens do Livro (Cinematográficas) */
.artigo-imagem-wrapper {
  margin: 2.2rem 0;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(166, 93, 55, 0.15);
  background: var(--bg-elevated);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.artigo-imagem-wrapper:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(166, 93, 55, 0.22);
}

.artigo-imagem {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  object-position: center 15%; /* Foca mais na parte superior (rostos) */
  display: block;
  border-radius: 12px;
  cursor: zoom-in; /* Indica que é clicável */
  transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.artigo-imagem-wrapper:hover .artigo-imagem {
  transform: scale(1.018);
}

.artigo-imagem-legenda {
  padding: 0.8rem 1.2rem;
  background: rgba(252, 250, 248, 0.96);
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-top: 1px solid rgba(166, 93, 55, 0.08);
  font-style: italic;
  text-align: center;
}

/* Conteúdo de Texto do Livro */
.artigo-corpo {
  max-width: 800px;
  color: var(--text-primary); /* Café Absoluto */
  font-family: 'Lato', sans-serif;
  font-size: 1.06rem;
  line-height: 1.85;
}

.artigo-corpo p {
  margin-bottom: 1.6rem;
  text-align: justify;
}

.artigo-corpo p:last-child {
  margin-bottom: 0;
}

.artigo-corpo .capitular::first-letter {
  font-family: 'Cinzel', serif;
  font-size: 3.2rem;
  float: left;
  line-height: 0.8;
  margin-right: 0.6rem;
  margin-top: 0.2rem;
  color: var(--gold);
  font-weight: 700;
}

/* Destaque / Citação Teológica */
.artigo-citacao {
  margin: 2.2rem 0;
  padding: 1.5rem 2rem;
  background: rgba(166, 93, 55, 0.04);
  border-left: 3px solid var(--wine);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

.artigo-citacao-autor {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-style: normal;
  color: var(--wine);
  margin-top: 0.6rem;
  letter-spacing: 0.05em;
}

/* Listagem de Tópicos internos dos Módulos */
.artigo-lista {
  list-style: none;
  margin: 1.8rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.artigo-lista-item {
  position: relative;
  padding-left: 1.5rem;
}

.artigo-lista-item::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--wine);
  font-size: 0.8rem;
}

/* Subseções internas (como Orixás em detalhes) */
.artigo-subsecao {
  margin-top: 2.5rem;
  border-top: 1px dashed rgba(166, 93, 55, 0.15);
  padding-top: 2rem;
}

.artigo-subtitulo {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
  color: var(--text-primary);
  margin-bottom: 0.8rem;
  font-weight: 700;
}

/* ===== GAVETA RESPONSIVA E COMPORTAMENTO MOBILE ===== */

/* Botão Flutuante do Sumário (Mobile) */
.btn-flutuante-sumario {
  display: none; /* Oculto no desktop */
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 999;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.8rem 1.6rem;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 25px rgba(139, 28, 28, 0.35);
  cursor: pointer;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition);
  outline: none;
}

.btn-flutuante-sumario:hover {
  transform: translateY(-3px);
  background: var(--gold-light);
  box-shadow: 0 12px 30px rgba(139, 28, 28, 0.45);
}

.btn-flutuante-sumario:active {
  transform: translateY(-1px);
}

/* Overlay do Drawer */
.sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(43, 29, 20, 0.5); /* Tom café escuro translúcido */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Regras de Media Queries para responsividade */
@media (max-width: 992px) {
  .livro-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  /* Transformando a Sidebar em Drawer Lateral */
  .livro-sidebar {
    position: fixed;
    top: 0;
    left: -330px; /* Esconde à esquerda */
    width: 320px;
    height: 100vh;
    max-height: 100vh;
    z-index: 2000;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-card);
    box-shadow: 15px 0 40px rgba(43, 29, 20, 0.15);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(252, 250, 248, 0.98);
  }

  .livro-sidebar.open {
    transform: translateX(330px); /* Move para a tela */
  }

  /* Botão Fechar no Drawer */
  .btn-close-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 34px;
    height: 34px;
    background: rgba(166, 93, 55, 0.1);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    outline: none;
  }

  .btn-close-sidebar:hover {
    background: var(--gold-muted);
    color: var(--gold);
  }

  .sidebar-title {
    margin-top: 1rem;
    padding-right: 3rem; /* Espaço para o botão fechar */
  }

  /* Revela botão flutuante */
  .btn-flutuante-sumario {
    display: inline-flex;
  }

  /* Ajustes do palco de leitura */
  .livro-leitura {
    padding: 2.2rem 1.8rem;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 576px) {
  .livro-leitura {
    padding: 1.8rem 1.2rem;
    border-radius: var(--radius);
  }

  .capitulo-header {
    margin-bottom: 1.8rem;
  }

  .artigo-corpo {
    font-size: 1rem;
  }

  .artigo-citacao {
    padding: 1.2rem 1.5rem;
  }

  .btn-flutuante-sumario {
    bottom: 1.5rem;
    left: 1.5rem;
    padding: 0.7rem 1.4rem;
    font-size: 0.8rem;
  }
}

/* ===== LIGHTBOX (GALERIA EXPANDIDA) ===== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 10, 7, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox-overlay.active {
  display: flex;
  opacity: 1;
}

.lightbox-img-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-overlay.active .lightbox-img-container {
  transform: scale(1);
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: -10px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--gold);
}

@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
  }
}

/* ============================================================
   MÓDULO 5: O TRABALHO PRÁTICO DA ESQUERDA (CARDS E BUSCA)
   ============================================================ */

/* Container da Barra de Busca */
.esquerda-search-container {
  position: relative;
  max-width: 100%;
  margin: 1rem 0 3rem 0;
  display: flex;
  align-items: center;
}

.esquerda-search-icon {
  position: absolute;
  left: 1.2rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.esquerda-search-input {
  width: 100%;
  padding: 1.2rem 1.5rem 1.2rem 3rem;
  font-family: 'Lato', sans-serif;
  font-size: 1.05rem;
  color: var(--text-primary);
  background: rgba(252, 250, 248, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(166, 93, 55, 0.2);
  border-radius: var(--radius-lg);
  outline: none;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.esquerda-search-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.esquerda-search-input:focus {
  border-color: #B85D19;
  box-shadow: 0 0 15px rgba(184, 93, 25, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.02);
  background: rgba(252, 250, 248, 0.9);
}

/* Esquerda Grid (Para alinhar os Cards) */
.esquerda-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  perspective: 1000px;
}

@media (min-width: 768px) {
  .esquerda-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Estilo do Card de Entidade (3D Tilt) */
.cartas-entidade {
  background: rgba(252, 250, 248, 0.85);
  border: 1px solid rgba(166, 93, 55, 0.15);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(166, 93, 55, 0.06);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, opacity 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.cartas-entidade.hidden-card {
  display: none !important;
}

.cartas-entidade:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 40px rgba(166, 93, 55, 0.12);
  border-color: rgba(184, 93, 25, 0.4);
}

.entidade-header {
  border-bottom: 1px dashed rgba(166, 93, 55, 0.2);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.entidade-nome {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--wine);
  margin-bottom: 0.3rem;
}

.entidade-dominio {
  font-family: 'Lato', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #B85D19;
}

.entidade-corpo p {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.entidade-corpo p strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* A clear entry point before the complete study. */
.public-page .livro-secao { padding-block: 28px 48px; }
.public-page .livro-leitura { padding: 32px; }
.public-page .capitulo-header { margin-bottom: 20px; padding-bottom: 16px; border-bottom-style: solid; }
.public-page .capitulo-tag { font: 700 .8125rem/1.5 'Lato', sans-serif; text-transform: none; letter-spacing: .03em; margin-bottom: 6px; }
.public-page .capitulo-titulo { font: 700 clamp(1.5rem, 3vw, 2rem)/1.35 'Lato', sans-serif; letter-spacing: -.02em; }
.study-progress { font-size: .8125rem; color: #755c50; margin-bottom: 10px; }
.study-intro { margin-bottom: 24px; }
.study-intro h3, .study-deeper-title { color: #2b1d14; font: 700 1.0625rem/1.5 'Lato', sans-serif; margin-bottom: 8px; }
#studySummary { color: #5c463a; font: 400 1.0625rem/1.75 'Lato', sans-serif; }
.study-terms { border-top: 1px solid #ded3c9; border-bottom: 1px solid #ded3c9; margin-top: 16px; }
.study-terms summary { padding-block: 12px; min-height: 44px; cursor: pointer; color: #8b1c1c; font-weight: 700; }
.study-terms dl { display: grid; grid-template-columns: minmax(100px, .35fr) minmax(0, 1fr); gap: 12px 18px; padding: 4px 0 16px; font-size: .9375rem; line-height: 1.65; }
.study-terms dt { font-weight: 700; color: #2b1d14; }
.study-terms dd { margin: 0; color: #5c463a; }
.public-page .artigo-imagem-wrapper { margin-block: 16px 24px; box-shadow: none; }
.public-page .artigo-imagem { max-height: 320px; }
.public-page .sidebar-title { font: 700 1.0625rem/1.4 'Lato', sans-serif; text-transform: none; letter-spacing: 0; margin-bottom: 12px; padding-bottom: 12px; }
.modulo-label { flex: 1; min-width: 0; padding-inline: 6px; }
.public-page .topico-btn { line-height: 1.5; }
.public-page .modulo-trigger { min-height: 44px; }
.study-pagination { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 12px; margin-top: 32px; padding-top: 24px; border-top: 1px solid #ded3c9; }
.study-nav-button, .study-choose { min-height: 48px; border: 1px solid #cabbaf; border-radius: 8px; background: #fcfaf8; color: #751818; padding: 12px; font: 400 .875rem/1.5 'Lato', sans-serif; cursor: pointer; }
.study-nav-button { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; }
.study-nav-button strong { font-weight: 700; }
.study-nav-button span { font-size: .8125rem; color: #68574d; }
.study-nav-button:disabled { opacity: .55; cursor: default; }
.study-nav-button:not(:disabled):hover, .study-choose:hover { background: #f2e8df; }
#studyNext { text-align: right; align-items: flex-end; }
@media (max-width: 992px) {
  .public-page .livro-leitura { padding: 24px; }
  .public-page .livro-sidebar { width: min(340px, 100vw); left: 0; transform: translateX(-100%); }
  .public-page .livro-sidebar.open { transform: translateX(0); }
  .public-page .btn-close-sidebar { min-width: 44px; min-height: 44px; }
  .public-page .btn-flutuante-sumario { font-family: 'Lato', sans-serif; font-size: .875rem; letter-spacing: 0; min-height: 44px; padding: 10px 16px; bottom: 16px; left: 16px; }
}
@media (max-width: 640px) {
  .public-page .livro-grid { padding-inline: 12px; }
  .public-page .livro-leitura { padding: 20px 16px; }
  .study-pagination { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .study-choose { grid-column: 1 / -1; grid-row: 2; }
  .study-terms dl { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .study-terms dd + dt { margin-top: 12px; }
}
