/* ==================================================================
   apps.brenotv.com.br - Camada de responsividade (mobile-first)
   Criado 27/07/2026. Carregado DEPOIS do <style> inline do index.php
   para sobrescrever apenas o necessario, sem alterar PHP/markup.
   ================================================================== */

*, *::before, *::after { box-sizing: border-box; }
/* 29/07/2026: so o html corta o excesso horizontal. Com overflow-x: hidden
   tambem no body, ele virava um segundo contexto de rolagem e apareciam
   duas barras no lado direito. overflow-x: clip corta sem criar barra. */
html { max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; overflow-x: visible; overflow-x: clip; }
img, video { max-width: 100%; height: auto; }

/* ---------- Header fixo: altura previsivel ---------- */
.site-title { padding: 12px 12px 10px; }
.site-title img { width: 60px; height: 60px; margin-bottom: 6px; }
.site-title h1 { font-size: 1.25rem; line-height: 1.2; word-break: break-word; }
.site-title.scrolled { padding: 8px 12px; }
.site-title.scrolled img { width: 36px; height: 36px; margin-bottom: 2px; }
.site-title.scrolled h1 { font-size: 1rem; }

/* ---------- Container ---------- */
#main { padding-top: 130px; padding-bottom: 1.5rem; }
#main .inner { width: 100%; max-width: 80em; margin: 0 auto; padding: 0 12px; }

/* ---------- Banner ---------- */
.banner-carousel { margin-top: 0; margin-bottom: 1.25rem; border-radius: 12px; overflow: hidden; }
.banner-carousel .owl-item img { width: 100%; height: 170px; object-fit: cover; display: block; }
.banner-carousel-caption { left: 8px; right: 8px; bottom: 8px; padding: 8px 12px; }
.banner-carousel-caption h3 { font-size: 0.95rem; margin: 0; }

/* ---------- Grid de apps: 2 colunas no celular ----------
   auto-fit (e nao auto-fill) para que a coluna vazia colapse: com poucos apps o card
   ocupa a largura disponivel em vez de ficar encolhido num canto da tela. */
.thumbnails { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; align-items: start; justify-content: initial; }
.thumbnails .box { width: auto; margin: 0 0 4px; display: flex; flex-direction: column; }
.box .inner { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.box h3 { font-size: 0.95rem; line-height: 1.25; margin: 0; overflow-wrap: anywhere; }
.box .image.fit img, .app-carousel img, .owl-carousel .owl-item img {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.codigo-badge { font-size: 0.7rem; padding: 2px 8px; }
.download-count { font-size: 0.75rem; }
.error-box { padding: 1.25rem; }
.error-box h2 { font-size: 1.05rem; line-height: 1.3; }

/* ---------- Botoes: area de toque minima 44px ---------- */
.box .button, .button.fit { display: flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 44px; padding: 10px 12px; font-size: 0.75rem; line-height: 1.2;
  white-space: normal; text-align: center; overflow-wrap: anywhere; }

/* ---------- WhatsApp flutuante ---------- */
.whatsapp-button { bottom: calc(16px + env(safe-area-inset-bottom)); right: 16px; }
.whatsapp-link { width: 52px; height: 52px; }
.whatsapp-link i { font-size: 26px; }

/* ---------- Footer ---------- */
#footer { padding: 2rem 12px 1.5rem; }
#footer .inner { width: 100%; padding: 0; }

/* ---------- Telas muito estreitas ---------- */
@media (max-width: 359px) {
  .thumbnails { grid-template-columns: 1fr; }
  .site-title h1 { font-size: 1.1rem; }
}

/* ---------- Celular grande / tablet pequeno ---------- */
@media (min-width: 480px) {
  .site-title img { width: 72px; height: 72px; }
  .site-title h1 { font-size: 1.5rem; }
  #main { padding-top: 155px; }
  .banner-carousel .owl-item img { height: 210px; }
  .thumbnails { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
  .box .button, .button.fit { font-size: 0.8rem; }
}

/* ---------- Tablet ---------- */
@media (min-width: 768px) {
  .site-title { padding: 20px 16px; }
  .site-title img { width: 96px; height: 96px; margin-bottom: 10px; }
  .site-title h1 { font-size: 2rem; }
  #main { padding-top: 200px; }
  .banner-carousel .owl-item img { height: 280px; }
  .thumbnails { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
  /* Teto de largura: com poucos apps o card cresce, mas sem ficar desproporcional */
  .thumbnails .box { max-width: 360px; }
  .banner-carousel-caption h3 { font-size: 1.2rem; }
}

/* ---------- Desktop: mantem 3 colunas ---------- */
@media (min-width: 1024px) {
  .site-title { padding: 30px 0; }
  .site-title img { width: 120px; height: 120px; margin-bottom: 15px; }
  .site-title h1 { font-size: 2.5rem; }
  #main { padding-top: 250px; padding-bottom: 2rem; }
  #main .inner { width: 90%; padding: 0; }
  .banner-carousel .owl-item img { height: 340px; }
  .thumbnails { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }
  .thumbnails .box { max-width: 420px; }
  .box h3 { font-size: 1.15rem; }
  .box .inner { padding: 16px; }
  .box .button, .button.fit { font-size: 0.9rem; min-height: 48px; }
  .whatsapp-button { bottom: 30px; right: 30px; }
  .whatsapp-link { width: 60px; height: 60px; }
  .whatsapp-link i { font-size: 30px; }
}
