/*
 * Ajustes de responsividade — IBA
 * Otimizado para Galaxy A15 (384 × 832 CSS px) e larguras móveis próximas.
 */
:root {
  scroll-padding-top: 5.5rem;
}

html,
body,
#root {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

html,
body {
  overflow-x: clip;
}

*,
*::before,
*::after {
  min-width: 0;
}

img,
video,
iframe,
svg {
  max-width: 100%;
}

img,
video {
  height: auto;
}

section,
footer {
  scroll-margin-top: 5.5rem;
}

@media (max-width: 639px) {
  body {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }

  /* Header: mais espaço útil para logo e controles no celular. */
  #main-header {
    padding-top: max(0.65rem, env(safe-area-inset-top));
    padding-bottom: 0.65rem;
  }

  #main-header > div {
    padding-left: 1rem;
    padding-right: 1rem;
    gap: 0.5rem;
  }

  #main-header #logo-btn {
    flex: 0 1 auto;
    min-width: 0;
    gap: 0.55rem;
  }

  #main-header #logo-btn > div:first-child {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
  }

  #main-header #logo-btn span {
    font-size: 1rem;
    letter-spacing: 0.12em;
  }

  #main-header #theme-toggle-mobile,
  #main-header #mobile-menu-toggle {
    min-width: 2.75rem;
    min-height: 2.75rem;
    flex: 0 0 auto;
  }

  #mobile-drawer {
    width: min(19rem, 88vw);
    max-width: 100vw;
    padding-bottom: env(safe-area-inset-bottom);
  }

  #mobile-drawer nav {
    overscroll-behavior: contain;
  }

  /* Evita o corte da primeira dobra causado pelo height:100vh inline. */
  #inicio {
    height: auto !important;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    padding-top: 5.5rem;
    padding-bottom: 4.5rem;
  }

  #inicio > .relative.z-10 {
    width: 100%;
    max-width: 100%;
    padding: 2rem 1rem 1rem;
  }

  #inicio h1 {
    max-width: 100%;
    font-size: clamp(2.25rem, 9.2vw, 3rem);
    line-height: 1.02;
    overflow-wrap: normal;
    word-break: normal;
  }

  #inicio p {
    max-width: 34rem;
    font-size: 0.98rem;
    line-height: 1.65;
  }

  /* Containers e seções: margens laterais consistentes. */
  .max-w-7xl,
  .max-w-5xl,
  .max-w-4xl,
  .max-w-3xl,
  .max-w-2xl {
    max-width: 100%;
  }

  section > .max-w-7xl,
  footer > .max-w-7xl,
  section > div > .max-w-7xl {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  section.py-24 {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }

  section .grid {
    min-width: 0;
  }

  section .grid > *,
  section .flex > * {
    min-width: 0;
  }

  section h2 {
    font-size: clamp(1.8rem, 7.5vw, 2.35rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
  }

  section p,
  footer p,
  section li {
    overflow-wrap: anywhere;
  }

  /* Cards, fotos e imagens não podem forçar largura além do viewport. */
  section img {
    max-width: 100%;
    object-fit: cover;
  }

  /* Botões e controles confortáveis para toque. */
  button,
  a[role="button"] {
    touch-action: manipulation;
  }

  section button,
  footer button {
    max-width: 100%;
  }

  /* Evita que blocos longos ou chaves PIX provoquem rolagem horizontal. */
  pre,
  code,
  address {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  footer {
    padding-top: 4rem;
    padding-bottom: max(2.5rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  #main-header > div {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  #inicio h1 {
    font-size: clamp(2.05rem, 8.8vw, 2.45rem);
  }

  #inicio > .relative.z-10 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  section > .max-w-7xl,
  footer > .max-w-7xl,
  section > div > .max-w-7xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* Âncora da seção Células: evita que o cabeçalho fixo cubra o título */
#celulas { scroll-margin-top: 6rem; }
