/* ==========================================================================
   JOSLAIN MINISTRIES - Responsiveness Rules
   Breakpoints: 1024px (Tablets), 768px (Small Tablets), 480px (Smartphones)
   ========================================================================== */

/* --- Medium/Large Screen adjustments --- */
@media (max-width: 1200px) {
  .container {
    padding: 0 30px;
  }
}

/* --- Laptop & Tablets (1024px) --- */
@media (max-width: 1024px) {
  html {
    font-size: 15px;
  }
  
  .about-split {
    gap: 40px;
  }
  
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .grid-container,
  .messages-grid,
  .testimonials-grid,
  .regions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
  
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }
}

/* --- Mobile Menu & Medium Devices (768px) --- */
@media (max-width: 992px) {
  .section-padding {
    padding: 60px 0;
  }
  
  /* Navigation Hamburger Menu Drawer */
  .hamburger {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-black) 100%);
    border-left: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 100px 40px;
    gap: 30px;
    z-index: 1050;
    transition: var(--transition-smooth);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
  }
  
  .nav-menu.active {
    right: 0;
  }
  
  .nav-item a {
    font-size: 1.1rem;
    font-weight: 700;
  }
  
  .nav-item.nav-btn-apoio {
    width: 100%;
    margin-top: 10px;
  }
  
  .nav-item.nav-btn-apoio a {
    display: block;
    text-align: center;
  }
  
  /* Hamburguer animation */
  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: var(--color-gold-light);
  }
  
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -8px);
    background: var(--color-gold-light);
  }

  /* Split sections to 1 column */
  .about-split,
  .prayer-split {
    flex-direction: column;
    gap: 40px;
  }
  
  .about-image-wrap,
  .about-text-wrap,
  .prayer-info-wrap,
  .prayer-form-wrap {
    width: 100%;
    flex: none;
  }
  
  .about-image-wrap {
    max-width: 500px;
    margin: 0 auto;
  }
  
  .hero-slider-section {
    height: 85vh;
  }
  
  .slide-content {
    margin-top: 20px;
  }
  
  .slide-title {
    font-size: 2.5rem;
  }
}

/* --- Smartphones (480px) --- */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
  
  .hero-slider-section {
    height: 80vh;
  }
  
  .slide-title {
    font-size: 2rem;
  }
  
  .slide-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .slide-actions .btn {
    width: 100%;
  }
  
  /* All grid systems to 1 column */
  .ministries-grid,
  .pillars-grid,
  .grid-container,
  .messages-grid,
  .testimonials-grid,
  .regions-grid,
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  
  .form-group-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .newsletter-form {
    flex-direction: column;
    gap: 15px;
  }
  
  .newsletter-form .btn {
    width: 100%;
  }
  
  .footer-copyright {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .about-photo-placeholder {
    padding: 30px 20px;
  }
}

/* ==========================================================================
   REFORÇO DE RESPONSIVIDADE (v2) - tipografia fluida + ajustes finos
   ========================================================================== */

/* Tudo respeita a largura da tela */
img, video, iframe, table { max-width: 100%; }
* { box-sizing: border-box; }

/* Tipografia fluida (escala suave entre celular e desktop grande) */
.slide-title   { font-size: clamp(1.9rem, 6vw, 3.6rem); line-height: 1.1; }
.slide-subtitle{ font-size: clamp(0.95rem, 2.2vw, 1.2rem); }
.section-title { font-size: clamp(1.6rem, 4.5vw, 2.6rem); }
.about-apostle-name { font-size: clamp(1.5rem, 4vw, 2.2rem); }

/* Botões confortáveis para o toque no celular */
@media (max-width: 768px) {
  .btn { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
  .nav-item a { padding: 6px 0; }
  /* Tabela do admin rola lateralmente sem quebrar o layout */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { min-width: 560px; }
  /* Abas da tela de Aparência: rolam em vez de espremer */
  .settings-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .settings-tab-btn { white-space: nowrap; }
  /* Foto do apóstolo centralizada e proporcional */
  .about-photo-frame { max-width: 420px; margin: 0 auto; }
}

/* Sidebar do admin vira gaveta deslizante no celular/tablet */
@media (max-width: 991px) {
  .admin-sidebar {
    position: fixed; left: -300px; top: 0; height: 100vh; width: 280px;
    z-index: 1040; transition: left 0.3s ease; overflow-y: auto;
  }
  .admin-sidebar.active { left: 0; box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
  .admin-main { margin-left: 0 !important; padding-top: 70px; }
}

/* Telas muito pequenas: hero não fica gigante e textos respiram */
@media (max-width: 400px) {
  .hero-slider-section { height: 88vh; }
  .slide-badge { font-size: 0.7rem; }
  .container { padding: 0 18px; }
}

/* Telas muito grandes: limita a largura para não esticar demais */
@media (min-width: 1600px) {
  .container { max-width: 1400px; }
}

/* ==========================================================================
   HARDENING (2026) - Fluid media, robust grids, safe forms
   Garante que imagens, vídeos e cards nunca quebrem o layout em nenhum device.
   ========================================================================== */

/* All media is fluid by default */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* Real event banner image fills the 16:9 card area */
.event-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Self-adjusting grids: 3 -> 2 -> 1 columns automatically, on any screen */
.grid-container,
.messages-grid,
.testimonials-grid,
.regions-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)) !important;
}

.pillars-grid,
.ministries-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)) !important;
}

/* Embedded responsive video (16:9) wrapper, if used anywhere */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* On tablets and phones, paired form fields stack to one column */
@media (max-width: 992px) {
  .form-group-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Extra safety on very small phones: never allow sideways scroll */
@media (max-width: 480px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .container { padding: 0 18px; }
  .section-title { font-size: 1.8rem; }
}
/* =========================================================
   AJUSTE MENSAGENS - impede card gigante nos filtros
   ========================================================= */

.messages-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 28px !important;
  align-items: stretch !important;
}

.message-card,
.video-card,
.mensagem-card {
  max-width: 100% !important;
  width: 100% !important;
}

.message-card.featured,
.video-card.featured,
.mensagem-card.featured,
.message-card:first-child,
.video-card:first-child,
.mensagem-card:first-child {
  grid-column: auto !important;
  width: 100% !important;
  max-width: 100% !important;
}

.message-thumbnail,
.video-thumbnail,
.message-img,
.video-img {
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  height: auto !important;
  max-height: 210px !important;
  object-fit: cover !important;
  display: block !important;
}

.message-card img,
.video-card img,
.mensagem-card img {
  width: 100% !important;
  aspect-ratio: 16 / 9 !important;
  object-fit: cover !important;
}

/* Desktop: no máximo 4 cards por linha */
@media (min-width: 1100px) {
  .messages-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Tablet: 2 cards */
@media (max-width: 992px) {
  .messages-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Celular: 1 card */
@media (max-width: 600px) {
  .messages-grid {
    grid-template-columns: 1fr !important;
  }
}
/* =========================================================
   HOME - centralizar os 3 vídeos da página inicial
   ========================================================= */

.home-messages-section .messages-grid,
#mensagens .messages-grid {
  max-width: 1050px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 28px !important;
  justify-content: center !important;
}

.home-messages-section .message-card,
#mensagens .message-card,
.home-messages-section .video-card,
#mensagens .video-card {
  width: 100% !important;
  max-width: 330px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Tablet */
@media (max-width: 992px) {
  .home-messages-section .messages-grid,
  #mensagens .messages-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: 720px !important;
  }
}

/* Celular */
@media (max-width: 600px) {
  .home-messages-section .messages-grid,
  #mensagens .messages-grid {
    grid-template-columns: 1fr !important;
    max-width: 360px !important;
  }
}
/* =========================================================
   CORREÇÃO EVENTOS - evita card gigante quando há poucos eventos
   ========================================================= */

.events-grid,
.eventos-grid,
.grid-container.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  justify-content: center;
  gap: 30px;
}

.event-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.event-card .event-image,
.event-card .event-img-wrap,
.event-card .event-thumb,
.event-card .event-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  max-height: 240px;
  overflow: hidden;
}

.event-card img,
.event-card .event-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* =========================================================
   CORREÇÃO EVENTOS - impedir evento único de ficar gigante
   ========================================================= */

.events-grid,
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  justify-content: center;
  gap: 30px;
}

.event-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.event-img-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto !important;
  max-height: 240px;
  overflow: hidden;
  position: relative;
}

.event-img-wrap .event-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Quando só houver 1 evento, ele não deve ocupar a página toda */
.event-card:only-child {
  max-width: 420px;
}